Correct AUTO_INCREMENT for Uint64 and Int64
This commit is contained in:
parent
2061731e2e
commit
f83842b48e
@ -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:
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uintptr:
|
||||||
sqlType = "integer"
|
sqlType = "integer"
|
||||||
if field.IsPrimaryKey {
|
if field.IsPrimaryKey {
|
||||||
sqlType += "primary key"
|
sqlType += " primary key"
|
||||||
}
|
}
|
||||||
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
|
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
|
||||||
sqlType += "autoincrement"
|
sqlType += " autoincrement"
|
||||||
}
|
}
|
||||||
case reflect.Int64, reflect.Uint64:
|
case reflect.Int64, reflect.Uint64:
|
||||||
sqlType = "bigint"
|
sqlType = "bigint"
|
||||||
if field.IsPrimaryKey {
|
if field.IsPrimaryKey {
|
||||||
field.TagSettings["AUTO_INCREMENT"] = "AUTO_INCREMENT"
|
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
|
||||||
sqlType = "integer primary key autoincrement"
|
sqlType = "integer primary key autoincrement"
|
||||||
} else {
|
} else {
|
||||||
|
sqlType += "integer primary key"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case reflect.Float32, reflect.Float64:
|
case reflect.Float32, reflect.Float64:
|
||||||
sqlType = "real"
|
sqlType = "real"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user