Select statement execution and mapping to struct or slice added.
This commit is contained in:
parent
319c9f757d
commit
75f8e0dfec
6 changed files with 291 additions and 13 deletions
|
|
@ -11,6 +11,8 @@ type {{.ToGoStructName}} struct {
|
|||
{{- range .Columns}}
|
||||
{{.ToGoFieldName}} sqlbuilder.NonAliasColumn
|
||||
{{- end}}
|
||||
|
||||
All []sqlbuilder.Projection
|
||||
}
|
||||
|
||||
var {{.ToGoVarName}} = &{{.ToGoStructName}}{
|
||||
|
|
@ -20,6 +22,8 @@ var {{.ToGoVarName}} = &{{.ToGoStructName}}{
|
|||
{{- range .Columns}}
|
||||
{{.ToGoFieldName}}: {{.ToGoVarName}},
|
||||
{{- end}}
|
||||
|
||||
All: []sqlbuilder.Projection{ {{.ToGoColumnFieldList ", "}} },
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -31,6 +35,10 @@ var (
|
|||
|
||||
var DataModelTemplate = `package model
|
||||
|
||||
{{range .GetImports}}
|
||||
import "{{.}}"
|
||||
{{end}}
|
||||
|
||||
type {{.ToGoModelStructName}} struct {
|
||||
{{- range .Columns}}
|
||||
{{.ToGoDMFieldName}} {{.ToGoType}} {{if .IsUnique}}` + "`sql:\"unique\"`" + ` {{end}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue