Skip to content

Commit da6fe0a

Browse files
authored
protos: Add missing field name (sqlc-dev#2354)
* buf: Add buf.yaml and buf.lock * protos: Add missing json_tags_id_uppercase proto field * Verify buf actions
1 parent e1e5ed6 commit da6fe0a

File tree

12 files changed

+204
-175
lines changed

12 files changed

+204
-175
lines changed

.github/workflows/buf.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: buf
2+
on: pull_request
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: bufbuild/buf-setup-action@v1
9+
- uses: bufbuild/buf-lint-action@v1

buf.lock

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Generated by buf. DO NOT EDIT.
2+
version: v1

buf.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: v1
2+
breaking:
3+
use:
4+
- FILE
5+
lint:
6+
use:
7+
- DEFAULT

internal/cmd/shim.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func pluginGoCode(s config.SQLGo) *plugin.GoCode {
8484
return &plugin.GoCode{
8585
EmitInterface: s.EmitInterface,
8686
EmitJsonTags: s.EmitJSONTags,
87-
JsonTagsIDUppercase: s.JsonTagsIDUppercase,
87+
JsonTagsIdUppercase: s.JsonTagsIDUppercase,
8888
EmitDbTags: s.EmitDBTags,
8989
EmitPreparedQueries: s.EmitPreparedQueries,
9090
EmitExactTableNames: s.EmitExactTableNames,

internal/codegen/golang/field.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TagsToString(tags map[string]string) string {
4242

4343
func JSONTagName(name string, settings *plugin.Settings) string {
4444
style := settings.Go.JsonTagsCaseStyle
45-
idUppercase := settings.Go.JsonTagsIDUppercase
45+
idUppercase := settings.Go.JsonTagsIdUppercase
4646
if style == "" || style == "none" {
4747
return name
4848
} else {

internal/codegen/golang/gen.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, querie
123123
tctx := tmplCtx{
124124
EmitInterface: golang.EmitInterface,
125125
EmitJSONTags: golang.EmitJsonTags,
126-
JsonTagsIDUppercase: golang.JsonTagsIDUppercase,
126+
JsonTagsIDUppercase: golang.JsonTagsIdUppercase,
127127
EmitDBTags: golang.EmitDbTags,
128128
EmitPreparedQueries: golang.EmitPreparedQueries,
129129
EmitEmptySlices: golang.EmitEmptySlices,

internal/endtoend/testdata/codegen_json/gen/codegen.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"inflection_exclude_table_names": [],
4141
"emit_pointers_for_null_types": false,
4242
"query_parameter_limit": 1,
43-
"output_batch_file_name": ""
43+
"output_batch_file_name": "",
44+
"json_tags_id_uppercase": false
4445
},
4546
"json": {
4647
"out": "gen",

internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"inflection_exclude_table_names": [],
4141
"emit_pointers_for_null_types": false,
4242
"query_parameter_limit": 1,
43-
"output_batch_file_name": ""
43+
"output_batch_file_name": "",
44+
"json_tags_id_uppercase": false
4445
},
4546
"json": {
4647
"out": "",

internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"inflection_exclude_table_names": [],
4141
"emit_pointers_for_null_types": false,
4242
"query_parameter_limit": 1,
43-
"output_batch_file_name": ""
43+
"output_batch_file_name": "",
44+
"json_tags_id_uppercase": false
4445
},
4546
"json": {
4647
"out": "",

internal/plugin/codegen.pb.go

+140-137
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/plugin/codegen_vtproto.pb.go

+36-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/plugin/codegen.proto

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ message GoCode
9898
bool emit_pointers_for_null_types = 22;
9999
optional int32 query_parameter_limit = 23;
100100
string output_batch_file_name = 24;
101+
bool json_tags_id_uppercase = 26;
101102
}
102103

103104
message JSONCode

0 commit comments

Comments
 (0)