You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched in Postgres docs and MySQL docs and found out that both of their smallint types hava a storage size of 2 bytes. So I'm wondering why smallint is currently mapped to int32 by default. Will int16 be a better choice?
The text was updated successfully, but these errors were encountered:
eeczw
changed the title
Why smallint type is mapped to int32 by default?
Why smallint is mapped to int32 by default?
May 23, 2024
The default type is determined based on business usage; generally, int16 is rarely used, and more int32 is used.
If it does not meet your needs, you can configure it through Data Mapping. https://gorm.io/gen/database_to_structs.html#Data-Mapping
gen/internal/model/base.go
Line 117 in 536bc26
I searched in Postgres docs and MySQL docs and found out that both of their smallint types hava a storage size of 2 bytes. So I'm wondering why smallint is currently mapped to int32 by default. Will int16 be a better choice?
The text was updated successfully, but these errors were encountered: