Skip to content
Snippets Groups Projects
Commit 6634e1f0eaac authored by Florent Aide's avatar Florent Aide
Browse files

add a FQColumns method on the generate db schemas

parent 547b573df49e
No related branches found
No related tags found
No related merge requests found
Pipeline #21377 passed
......@@ -96,6 +96,9 @@
for _, p := range packages {
pkg = p
}
if pkg == nil {
log.Fatal("pkg cannot be nil here...")
}
topLevel := Package{Name: pkg.Name, AllStructs: make(map[string]*ast.StructType)}
......@@ -506,6 +509,22 @@
return {{.Name}}DataColumns
}
// FQColumns returns the database table column names prefixed with the table alias
func (t {{.Name}}TableSchema) FQColumns(withPKey bool) []string {
var colList []string
colList = {{.Name}}DataColumns
if withPKey {
colList = {{.Name}}Columns
}
var cols []string
for _, col := range colList {
cols = append(cols, t.GetName()+"."+col)
}
return cols
}
func (t {{.Name}}TableSchema) As(name string) *{{.Name}}TableSchema {
t.alias = name
{{- range .Fields}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment