Skip to main content

Field Types

goclarc supports 9 schema types. Each maps to different Go types depending on the database adapter and nullable flag.

Type Reference

uuid

A UUID string identifier. Typically used for primary keys.

PostgreSQLMongoDBFirebase RTDB
Entitystringstringstring
Viewstringstringstring
Createstringstringstring
Update*string*string*string

string

A text field.

PostgreSQL (non-null)PostgreSQL (nullable)MongoDBRTDB
Entitystring*stringstring / *stringstring / *string
Viewstringstringstringstring
Createstring*stringstring / *stringstring / *string
Update*string*string*string*string

int

A 32-bit integer.

Non-nullableNullable
Entityint32*int32
Viewint32int32
Createint32*int32
Update*int32*int32

Note: Firebase RTDB uses plain int (not int32).


int64

A 64-bit integer.

Non-nullableNullable
Entityint64*int64
Viewint64int64
Createint64*int64
Update*int64*int64

float

A 64-bit floating-point number.

Non-nullableNullable
Entityfloat64*float64
Viewfloat64float64
Createfloat64*float64
Update*float64*float64

bool

A boolean value.

Non-nullableNullable
Entitybool*bool
Viewboolbool
Createbool*bool
Update*bool*bool

timestamp

A date-time value. View is always a string (RFC3339).

PostgreSQLMongoDBFirebase RTDB
Entity (non-null)time.Timetime.Timeint64 (unix ms)
Entity (nullable)*time.Time*time.Timeint64
Viewstring (RFC3339)string (RFC3339)int64
Createtime.Timetime.Timeint64
Update*time.Time*time.Time*int64

Typically used with auto: true for created_at / updated_at fields.


json

Arbitrary JSON / document data.

PostgreSQLMongoDBFirebase RTDB
Entityjson.RawMessagebson.Mmap[string]interface{}
Viewjson.RawMessagebson.Mmap[string]interface{}
Createjson.RawMessagebson.Mmap[string]interface{}
Updatejson.RawMessagebson.Mmap[string]interface{}

nullable has no effect on json fields. All three Go types are already reference types (slice or map). Setting nullable: true does not introduce a pointer and does not generate a nil-guard dereference in ToView() — the field is assigned directly.


string[]

An array of strings.

All adapters
Entity[]string
View[]string
Create[]string
Update[]string

Update Params

For non-auto fields, UpdateParams always uses pointer types to allow partial updates — only non-nil values are applied in the repository:

type UpdateParams struct {
ID string
Email *string // nil = don't update this field
Name *string
Age *int32
}

The generated repository applies a COALESCE(@field, field) pattern for Postgres, and checks if p.Field != nil for MongoDB and RTDB.