fix: int type field size should is int32

This commit is contained in:
aveyuan 2024-04-18 14:06:16 +08:00
parent d0b4ceb726
commit 87475a2818

View File

@ -328,13 +328,13 @@ func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field {
if field.Size == 0 { if field.Size == 0 {
switch reflect.Indirect(fieldValue).Kind() { switch reflect.Indirect(fieldValue).Kind() {
case reflect.Int, reflect.Int64, reflect.Uint, reflect.Uint64, reflect.Float64: case reflect.Int64, reflect.Uint64, reflect.Float64:
field.Size = 64 field.Size = 64
case reflect.Int8, reflect.Uint8: case reflect.Int8, reflect.Uint8:
field.Size = 8 field.Size = 8
case reflect.Int16, reflect.Uint16: case reflect.Int16, reflect.Uint16:
field.Size = 16 field.Size = 16
case reflect.Int32, reflect.Uint32, reflect.Float32: case reflect.Int, reflect.Uint, reflect.Int32, reflect.Uint32, reflect.Float32:
field.Size = 32 field.Size = 32
} }
} }