Pre-alpha. No tagged release and no upgrade path between versions. Use for evaluation and development only, not production.
Core DevPre-alpha

Field types

Models embed sdk.Model and use typed field markers from sumeru/core/sdk. Schema is inferred at registration from Go types and sumeru struct tags. For declaration examples see Models & fields.

Scalar and relational types

Go typePostgreSQLNotes
sdk.StringVARCHAR (default 255)size= for length; column= for physical name
sdk.TextTEXT
sdk.HTMLTEXTRich text; widget html
sdk.EmailVARCHARWidget email
sdk.PhoneVARCHARWidget phone
sdk.URLVARCHARWidget url
sdk.UUIDVARCHAR(36)Use default=uuid for server-generated values
sdk.BooleanBOOLEAN
sdk.IntegerBIGINTmin=, max=
sdk.FloatREAL32-bit
sdk.Float64DOUBLE PRECISION64-bit
sdk.NumericNUMERIC(p,s)precision=, scale=
sdk.MoneyNUMERIC(p,s)Defaults 18,2; pair with currency=FieldName
sdk.DateDATE
sdk.TimeTEXTTime-of-day string; widget time
sdk.DateTimeTIMESTAMPTZ
sdk.DurationNUMERIC(p,s)Stored as decimal; widget duration
sdk.JsonJSONB
sdk.BinaryTEXTAttachment payload; widget binary
sdk.ImageTEXTImage payload; widget image
sdk.Selection[T ~string]VARCHAR(50)Options from const blocks in selection_types.go
sdk.Many2One[T]BIGINTFK; ondelete=; comodel= when using sdk.Any
sdk.One2Many[T]*(no column)*inverse= names the Many2one on the child
sdk.Many2Many[T]*(no column)*table=, left=, right= for join table
sdk.ReferenceVARCHARPolymorphic model name; widget reference
sdk.Many2OneReferenceBIGINTPolymorphic id; model_field= names the model field

Derived fields

Any scalar marker can carry:

  • related=other_field.subfield — read-only mirror of a related value (no separate column logic beyond the source).
  • compute=name — filled by a handler registered with orm.RegisterCompute; optional store persists to the column on write; readonly blocks client edits.

Common struct tags

required, unique, index, default=, string= (label), column=, size=, precision=, scale=, currency=, min=, max=, comodel=, inverse=, ondelete=, table=, left=, right=, model_field=, related=, compute=, store, readonly, groups=

Typed selections do not use inline selection= tags — define const blocks and use sdk.Selection[YourType].

Registration

Generated models/zmodels.go calls sdk.MustRegister on make generate. Authors do not write Fields() or hand-register models in addon init(). Cross-module relation types come from generated models/zrefs.go after listing modules in depends.

See also