mirror of https://github.com/lqs/sqlingo
Merge 1ec93c28ba into e6ea482d73
This commit is contained in:
commit
5b13ca8fd8
|
|
@ -101,8 +101,8 @@ func getType(fieldDescriptor fieldDescriptor) (goType string, fieldClass string,
|
|||
fieldClass = "StringField"
|
||||
case "array":
|
||||
// TODO: Switch to specific type instead of interface.
|
||||
goType = "[]interface{}"
|
||||
fieldClass = "ArrayField"
|
||||
goType = "string"
|
||||
fieldClass = "StringField"
|
||||
case "timestamp":
|
||||
if !timeAsString {
|
||||
goType = "time.Time"
|
||||
|
|
@ -132,6 +132,9 @@ func getType(fieldDescriptor fieldDescriptor) (goType string, fieldClass string,
|
|||
goType = "string"
|
||||
fieldClass = "StringField"
|
||||
}
|
||||
case "user-defined":
|
||||
goType = "string"
|
||||
fieldClass = "StringField"
|
||||
default:
|
||||
err = fmt.Errorf("unknown field type %s", fieldDescriptor.Type)
|
||||
return
|
||||
|
|
@ -247,10 +250,6 @@ func Generate(driverName string, exampleDataSourceName string) (string, error) {
|
|||
code += "\tsqlingo.BooleanField\n"
|
||||
code += "}\n\n"
|
||||
|
||||
code += "type arrayField interface {\n"
|
||||
code += "\tsqlingo.ArrayField\n"
|
||||
code += "}\n\n"
|
||||
|
||||
code += "type dateField interface {\n"
|
||||
code += "\tsqlingo.DateField\n"
|
||||
code += "}\n\n"
|
||||
|
|
@ -435,5 +434,6 @@ func generateTable(schemaFetcher schemaFetcher, tableName string, forceCases []s
|
|||
// replaceTypeSpace : To compatible some types contains spaces in postgresql
|
||||
// like [character varying, timestamp without time zone, timestamp with time zone]
|
||||
func replaceTypeSpace(typename string) string {
|
||||
return strings.ReplaceAll(typename, " ", "_")
|
||||
typename = strings.ReplaceAll(typename, " ", "_")
|
||||
return strings.ReplaceAll(typename, "-", "_")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue