jet/generator/metadata/table_meta_data.go
Eli Ribble 2053415c76
Make it possible to add fully custom columns to table definition
This adds a few different fields to the column SQL builder that were
once either calculated or hard-coded:
 * Import - so you can import the column from anywhere
 * Type - fully, rather than partially, modifiable to allow any naming
   convention
 * TypeFactory - fully, rather than partially defined

I also alphabetized some things because the OCD compels me.
2026-05-06 16:26:38 +00:00

37 lines
675 B
Go

package metadata
// Table metadata struct
type Table struct {
Comment string
Columns []Column
Imports []string
Name string `sql:"primary_key"`
}
// MutableColumns returns list of mutable columns for table
func (t Table) MutableColumns() []Column {
var ret []Column
for _, column := range t.Columns {
if column.IsPrimaryKey || column.IsGenerated {
continue
}
ret = append(ret, column)
}
return ret
}
// DefaultColumns returns list of columns with default values set for table
func (t Table) DefaultColumns() []Column {
var ret []Column
for _, column := range t.Columns {
if column.HasDefault {
ret = append(ret, column)
}
}
return ret
}