Skip to content

Commit 25e4578

Browse files
Merge pull request #2 from MerlinVeritas/fix/struct-format
Fix/struct format
2 parents 8ce1d55 + fea4567 commit 25e4578

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/gen.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func makePyType(req *plugin.GenerateRequest, col *plugin.Column) pyType {
213213
}
214214
}
215215
}
216-
216+
217217
// No override found, use the standard type mapping
218218
typ := pyInnerType(req, col)
219219
return pyType{
@@ -253,9 +253,9 @@ func methodName(name string) string {
253253
var pyIdentPattern = regexp.MustCompile("[^a-zA-Z0-9_]+")
254254

255255
func pyEnumValueName(value string) string {
256-
id := strings.Replace(value, "-", "_", -1)
257-
id = strings.Replace(id, ":", "_", -1)
258-
id = strings.Replace(id, "/", "_", -1)
256+
id := strings.ReplaceAll(value, "-", "_")
257+
id = strings.ReplaceAll(id, ":", "_")
258+
id = strings.ReplaceAll(id, "/", "_")
259259
id = pyIdentPattern.ReplaceAllString(id, "")
260260
return strings.ToUpper(id)
261261
}
@@ -440,7 +440,7 @@ func buildQueries(conf Config, req *plugin.GenerateRequest, structs []Struct) ([
440440
gq.Args = []QueryValue{{
441441
Emit: true,
442442
Name: "arg",
443-
Struct: columnsToStruct(req, query.Name+"Params", cols),
443+
Struct: columnsToStruct(req, modelName(query.Name+"Params", req.Settings), cols),
444444
}}
445445
} else {
446446
args := make([]QueryValue, 0, len(query.Params))
@@ -495,7 +495,7 @@ func buildQueries(conf Config, req *plugin.GenerateRequest, structs []Struct) ([
495495
Column: c,
496496
})
497497
}
498-
gs = columnsToStruct(req, query.Name+"Row", columns)
498+
gs = columnsToStruct(req, modelName(query.Name+"Row", req.Settings), columns)
499499
emit = true
500500
}
501501
gq.Ret = QueryValue{

0 commit comments

Comments
 (0)