Skip to main content

Column Types

Available types for resource columns are defined in column.go.

The SDK types in schema.ValueType are tied to both Go and database types:

  • Columns defined as a certain ValueType expect certain Go types as values (e.g. A column in the type schema.TypeBigInt expects values of the Go types int, uint32 or int64)
  • schema.DBTypeFromType (in dialect.go) is used to determine which datatype is used in the database table definition.
ValueTypeGo Type(s)
TypeBigIntint, uint32, int64
TypeBoolbool
TypeFloatfloat32, float64
TypeIntuint16, int32
TypeSmallIntint8, uint8, int16
TypeStringstring
TypeCIDRnet.IPNet
TypeInetnet.IP, net.IPAddr
TypeJSONstruct, slice, map
TypeMacAddrnet.HardwareAddr
TypeTimestamptime.Time
TypeUUIDuuid.UUID
TypeByteArray[]byte
TypeStringArray[]string
TypeCIDRArray[]net.IPNet
TypeInetArray[]net.IP, []net.IPAddr
TypeIntArray[]uint16, []int32
TypeMacAddrArray[]net.HardwareAddr
TypeUUIDArray[]uuid.UUID