codegen: add helpers
All checks were successful
CI / build-docker (push) Successful in 4s
CI / build-docker-bootstrap (push) Has been skipped
CI / release-test (push) Successful in 15s

This commit is contained in:
2026-01-31 20:35:03 -08:00
parent b8a024a4b9
commit 5cbb657666
3 changed files with 44 additions and 34 deletions

View File

@@ -305,7 +305,7 @@ func GenerateModelTestAST(tbl schema.Table, gomodName string) *ast.File {
Lhs: []ast.Expr{
&ast.SelectorExpr{
X: ast.NewIdent(tbl.VarName),
Sel: ast.NewIdent(fkFieldName(col)),
Sel: ast.NewIdent(col.GoFieldName()),
},
},
Tok: token.ASSIGN,
@@ -346,11 +346,11 @@ func GenerateModelTestAST(tbl schema.Table, gomodName string) *ast.File {
ast.NewIdent("err"),
&ast.BasicLit{
Kind: token.STRING,
Value: fmt.Sprintf("%q", fkFieldName(col)),
Value: fmt.Sprintf("%q", col.GoFieldName()),
},
&ast.SelectorExpr{
X: ast.NewIdent(tbl.VarName),
Sel: ast.NewIdent(fkFieldName(col)),
Sel: ast.NewIdent(col.GoFieldName()),
},
},
},