Correct AUTO_INCREMENT for Uint64 and Int64

This commit is contained in:
Seth Shelnutt 2016-05-06 09:08:17 -04:00
parent 2061731e2e
commit f83842b48e

View File

@ -31,17 +31,19 @@ func (sqlite3) DataTypeOf(field *StructField) string {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uintptr:
sqlType = "integer"
if field.IsPrimaryKey {
sqlType += "primary key"
sqlType += " primary key"
}
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
sqlType += "autoincrement"
sqlType += " autoincrement"
}
case reflect.Int64, reflect.Uint64:
sqlType = "bigint"
if field.IsPrimaryKey {
field.TagSettings["AUTO_INCREMENT"] = "AUTO_INCREMENT"
sqlType = "integer primary key autoincrement"
} else {
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
sqlType = "integer primary key autoincrement"
} else {
sqlType += "integer primary key"
}
}
case reflect.Float32, reflect.Float64:
sqlType = "real"