File tree Expand file tree Collapse file tree 6 files changed +21
-31
lines changed
endtoend/testdata/overrides_go_struct_tags/invalid_tags Expand file tree Collapse file tree 6 files changed +21
-31
lines changed Original file line number Diff line number Diff line change @@ -33,17 +33,17 @@ type Override struct {
33
33
// fully qualified name of the column, e.g. `accounts.id`
34
34
Column string `json:"column" yaml:"column"`
35
35
36
- ColumnName * pattern.Match
37
- TableCatalog * pattern.Match
38
- TableSchema * pattern.Match
39
- TableRel * pattern.Match
40
- GoImportPath string
41
- GoPackage string
42
- GoTypeName string
43
- GoBasicType bool
36
+ ColumnName * pattern.Match `json:"-"`
37
+ TableCatalog * pattern.Match `json:"-"`
38
+ TableSchema * pattern.Match `json:"-"`
39
+ TableRel * pattern.Match `json:"-"`
40
+ GoImportPath string `json:"-"`
41
+ GoPackage string `json:"-"`
42
+ GoTypeName string `json:"-"`
43
+ GoBasicType bool `json:"-"`
44
44
45
45
// Parsed form of GoStructTag, e.g. {"validate:", "required"}
46
- GoStructTags map [string ]string
46
+ GoStructTags map [string ]string `json:"-"`
47
47
}
48
48
49
49
func (o * Override ) Parse () (err error ) {
Original file line number Diff line number Diff line change @@ -269,7 +269,6 @@ func Combine(conf Config, pkg SQL) CombinedSettings {
269
269
for k , v := range pkg .Gen .Go .Rename {
270
270
cs .Rename [k ] = v
271
271
}
272
- cs .Overrides = append (cs .Overrides , pkg .Gen .Go .Overrides ... )
273
272
}
274
273
if pkg .Gen .JSON != nil {
275
274
cs .JSON = * pkg .Gen .JSON
Original file line number Diff line number Diff line change @@ -35,17 +35,17 @@ type Override struct {
35
35
// fully qualified name of the column, e.g. `accounts.id`
36
36
Column string `json:"column" yaml:"column"`
37
37
38
- ColumnName * pattern.Match
39
- TableCatalog * pattern.Match
40
- TableSchema * pattern.Match
41
- TableRel * pattern.Match
42
- GoImportPath string
43
- GoPackage string
44
- GoTypeName string
45
- GoBasicType bool
38
+ ColumnName * pattern.Match `json:"-"`
39
+ TableCatalog * pattern.Match `json:"-"`
40
+ TableSchema * pattern.Match `json:"-"`
41
+ TableRel * pattern.Match `json:"-"`
42
+ GoImportPath string `json:"-"`
43
+ GoPackage string `json:"-"`
44
+ GoTypeName string `json:"-"`
45
+ GoBasicType bool `json:"-"`
46
46
47
47
// Parsed form of GoStructTag, e.g. {"validate:", "required"}
48
- GoStructTags map [string ]string
48
+ GoStructTags map [string ]string `json:"-"`
49
49
}
50
50
51
51
func (o * Override ) Parse () (err error ) {
Original file line number Diff line number Diff line change @@ -96,18 +96,13 @@ func v1ParseConfig(rd io.Reader) (Config, error) {
96
96
* settings .Packages [j ].QueryParameterLimit = 1
97
97
}
98
98
99
- for i := range settings .Packages [j ].Overrides {
100
- if err := settings .Packages [j ].Overrides [i ].Parse (); err != nil {
101
- return config , err
102
- }
103
- }
104
99
if settings .Packages [j ].Name == "" {
105
100
settings .Packages [j ].Name = filepath .Base (settings .Packages [j ].Path )
106
101
}
102
+
107
103
if settings .Packages [j ].Engine == "" {
108
104
settings .Packages [j ].Engine = EnginePostgreSQL
109
105
}
110
-
111
106
}
112
107
113
108
return settings .Translate (), nil
Original file line number Diff line number Diff line change @@ -84,11 +84,6 @@ func v2ParseConfig(rd io.Reader) (Config, error) {
84
84
* conf .SQL [j ].Gen .Go .QueryParameterLimit = 1
85
85
}
86
86
87
- for i := range conf .SQL [j ].Gen .Go .Overrides {
88
- if err := conf .SQL [j ].Gen .Go .Overrides [i ].Parse (); err != nil {
89
- return conf , err
90
- }
91
- }
92
87
for k , v := range conf .SQL [j ].Gen .Go .Rename {
93
88
conf .SQL [j ].Gen .Go .Rename [k ] = v
94
89
}
Original file line number Diff line number Diff line change 1
- error parsing sqlc.json: bad syntax for struct tag pair
1
+ # package override
2
+ error generating code: bad syntax for struct tag pair
You can’t perform that action at this time.
0 commit comments