Add StringColumn type and expression
Add Projection type Alias refactoring More numeric operations
This commit is contained in:
parent
033ab1d0da
commit
b2f84d048c
16 changed files with 350 additions and 199 deletions
|
|
@ -26,6 +26,31 @@ func (c ColumnInfo) ToGoVarName() string {
|
|||
return snaker.SnakeToCamel(c.Name) + "Column"
|
||||
}
|
||||
|
||||
func (c ColumnInfo) ToSqlBuilderColumnType() string {
|
||||
switch c.DataType {
|
||||
case "boolean":
|
||||
return "BoolColumn"
|
||||
case "smallint":
|
||||
return "IntegerColumn"
|
||||
case "integer":
|
||||
return "IntegerColumn"
|
||||
case "bigint":
|
||||
return "IntegerColumn"
|
||||
case "date", "timestamp without time zone", "timestamp with time zone":
|
||||
return "StringColumn"
|
||||
case "bytea":
|
||||
return "StringColumn"
|
||||
case "text":
|
||||
return "StringColumn"
|
||||
case "real":
|
||||
return "NumericColumn"
|
||||
case "numeric", "double precision":
|
||||
return "NumericColumn"
|
||||
default:
|
||||
return "StringColumn"
|
||||
}
|
||||
}
|
||||
|
||||
func (c ColumnInfo) ToGoType() string {
|
||||
typeStr := c.GoBaseType()
|
||||
if c.IsNullable || c.TableInfo.IsForeignKey(c.Name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue