Supported Fields
Enterprise supports a variety of field types to map PostgreSQL columns to Go variables.
Supported Types
Boolean:
models.BoolField(name)maps toboolean.Byte:
models.ByteField(name)maps tobytea.UUID:
models.UUIDField(name)maps touuid.Integer: -
models.IntField(name)maps tointeger. -models.SmallIntField(name)maps tosmallint. -models.BigIntField(name)maps tobigint.Unsigned Integer:
models.UintField(name)maps tointeger.Floating Point: -
models.Float32Field(name)maps toreal. -models.Float64Field(name)maps todouble precision.String:
models.StringField(name)maps tovarchar.Decimal:
models.DecimalField(name, precision, scale)maps tonumeric(precision, scale).String Array:
models.StringArrayField(name)maps totext[].Enum:
models.EnumField(name, values)maps tovarcharwith validation.Time:
models.TimeField(name)maps totimestamp with time zone.JSON:
models.JSONField(name)maps tojsonb.Custom Type:
models.CustomField(name, dbType, valuerScannerInstance)maps to any user-defined type implementingsql.Scanneranddriver.Valuer.
Common Configuration Methods
Every field type returns a builder interface that supports chainable configuration methods:
// Set a custom database column name (defaults to snake_case of field name)
field.SetDBName("custom_column_name")
// Mark the field as nullable (scanned as pointer types in Go)
field.SetNillable()
// Add serial auto-increment tag (for integer fields)
field.AddSerial()
// Define a static default value
field.Default(value)
// Define a dynamic default function (evaluated at entity initialization)
field.DefaultFunc(func)