-
Notifications
You must be signed in to change notification settings - Fork 978
feat(codegen): add support for build tags (#2012) #2807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d3dde8e
84c47ba
1dfd3c6
3f2139c
25aff98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,9 @@ | ||
| {{define "dbFile"}}// Code generated by sqlc. DO NOT EDIT. | ||
| {{define "dbFile"}} | ||
| {{if .BuildTags}} | ||
| //go:build {{.BuildTags}} | ||
| // +build {{.BuildTags}} | ||
|
||
|
|
||
| {{end}}// Code generated by sqlc. DO NOT EDIT. | ||
| // versions: | ||
| // sqlc {{.SqlcVersion}} | ||
|
|
||
|
|
@@ -24,7 +29,12 @@ import ( | |
|
|
||
| {{end}} | ||
|
|
||
| {{define "interfaceFile"}}// Code generated by sqlc. DO NOT EDIT. | ||
| {{define "interfaceFile"}} | ||
| {{if .BuildTags}} | ||
| //go:build {{.BuildTags}} | ||
| // +build {{.BuildTags}} | ||
|
|
||
| {{end}}// Code generated by sqlc. DO NOT EDIT. | ||
| // versions: | ||
| // sqlc {{.SqlcVersion}} | ||
|
|
||
|
|
@@ -48,7 +58,12 @@ import ( | |
| {{end}} | ||
| {{end}} | ||
|
|
||
| {{define "modelsFile"}}// Code generated by sqlc. DO NOT EDIT. | ||
| {{define "modelsFile"}} | ||
| {{if .BuildTags}} | ||
| //go:build {{.BuildTags}} | ||
| // +build {{.BuildTags}} | ||
|
|
||
| {{end}}// Code generated by sqlc. DO NOT EDIT. | ||
| // versions: | ||
| // sqlc {{.SqlcVersion}} | ||
|
|
||
|
|
@@ -141,7 +156,12 @@ type {{.Name}} struct { {{- range .Fields}} | |
| {{end}} | ||
| {{end}} | ||
|
|
||
| {{define "queryFile"}}// Code generated by sqlc. DO NOT EDIT. | ||
| {{define "queryFile"}} | ||
| {{if .BuildTags}} | ||
| //go:build {{.BuildTags}} | ||
| // +build {{.BuildTags}} | ||
|
|
||
| {{end}}// Code generated by sqlc. DO NOT EDIT. | ||
| // versions: | ||
| // sqlc {{.SqlcVersion}} | ||
| // source: {{.SourceName}} | ||
|
|
@@ -166,7 +186,12 @@ import ( | |
| {{end}} | ||
| {{end}} | ||
|
|
||
| {{define "copyfromFile"}}// Code generated by sqlc. DO NOT EDIT. | ||
| {{define "copyfromFile"}} | ||
| {{if .BuildTags}} | ||
| //go:build {{.BuildTags}} | ||
| // +build {{.BuildTags}} | ||
|
|
||
| {{end}}// Code generated by sqlc. DO NOT EDIT. | ||
| // versions: | ||
| // sqlc {{.SqlcVersion}} | ||
| // source: {{.SourceName}} | ||
|
|
@@ -191,7 +216,12 @@ import ( | |
| {{end}} | ||
| {{end}} | ||
|
|
||
| {{define "batchFile"}}// Code generated by sqlc. DO NOT EDIT. | ||
| {{define "batchFile"}} | ||
| {{if .BuildTags}} | ||
| //go:build {{.BuildTags}} | ||
| // +build {{.BuildTags}} | ||
|
|
||
| {{end}}// Code generated by sqlc. DO NOT EDIT. | ||
| // versions: | ||
| // sqlc {{.SqlcVersion}} | ||
| // source: {{.SourceName}} | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| -- name: GetAuthor :one | ||
| SELECT * FROM authors | ||
| WHERE id = $1 LIMIT 1; | ||
|
|
||
| -- name: ListAuthors :many | ||
| SELECT * FROM authors | ||
| ORDER BY name; | ||
|
|
||
| -- name: CreateAuthor :one | ||
| INSERT INTO authors ( | ||
| name, bio | ||
| ) VALUES ( | ||
| $1, $2 | ||
| ) | ||
| RETURNING *; | ||
|
|
||
| -- name: DeleteAuthor :exec | ||
| DELETE FROM authors | ||
| WHERE id = $1; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| CREATE TABLE authors ( | ||
| id BIGSERIAL PRIMARY KEY, | ||
| name text NOT NULL, | ||
| bio text | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "version": "1", | ||
| "packages": [ | ||
| { | ||
| "path": "go", | ||
| "name": "authors", | ||
| "engine": "postgresql", | ||
| "schema": "schema.sql", | ||
| "queries": "query.sql", | ||
| "omit_unused_structs": true, | ||
| "emit_interface": true, | ||
| "build_tags": "some_tag" | ||
| } | ||
| ] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.