Alpha (platform kernel). Suitable for demos and custom modules. Not for production or regulated workloads.
Core DevAlpha

Models and fields

Addon business models are Go structs that embed sdk.Model and declare fields with typed markers and optional sumeru struct tags.

Minimal model

go
go
package models

import "sumeru/core/sdk"

type MyNotes struct {
    sdk.Model `sumeru:"model=my.notes"`

    Name   sdk.String  `sumeru:"required,index,string=Name"`
    Active sdk.Boolean `sumeru:"default=true"`
    Body   sdk.Text
}

No ModelName(), Fields(), init(), or RegisterModel in model files. After adding a model struct, run make generate (part of make build) so zmodels.go registers it.

The Module for registration comes from manifest.json name.

Model inherit

Extend an existing model (same PostgreSQL table) from a dependent module with inherit=:

go
go
type PartnerContacts struct {
    sdk.Model `sumeru:"inherit=core.partner"`

    CustomerRank sdk.Integer `sumeru:"string=Customer Rank,default=0"`
}
  • inherit= and model= are mutually exclusive on one struct.
  • The target model must already be registered (use depends on the owning module).
  • Run make generate, then -u your_module for additive schema sync.
  • Add view xpath inherit so new fields appear in forms.

See Model inherit how-to.

Field types

Go typeSQLNotes
sdk.StringVARCHARUse size= tag for length
sdk.TextTEXT
sdk.BooleanBOOLEAN
sdk.IntegerBIGINT
sdk.FloatREAL32-bit
sdk.Float64DOUBLE PRECISION64-bit
sdk.NumericNUMERICprecision=, scale=
sdk.Date / sdk.DateTimeDATE / TIMESTAMPTZ
sdk.JsonJSONB
sdk.Many2One[T]BIGINT FKcomodel= when T is sdk.Any
sdk.One2Many[T] / sdk.Many2Many[T]virtualcomodel=, table=, left=, right=

Cross-package FKs (wizards pointing at another module’s model) use sdk.Many2One[sdk.Any] plus comodel=other.model. Typed Many2One[T] only works when T is in the same Go package.

Selection lists: use sdk.String with selection=key:Label,key:Label in the tag.

Common tags

required, unique, index, default=, string= (label), column=, comodel=, selection=

Runtime API

Prefer sdk.Search, sdk.Create, sdk.Upsert with struct-based inputs. Records remain map[string]interface{} at runtime.