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

Models & fields

sdk.Model tags, field markers, relations, and how runtime records are maps.

sdk.Model and generate

Prefer sumeru/core/sdk over importing sumeru/core/orm directly. Embed sdk.Model with a sumeru:"model=…" tag. After adding a struct, run make generate so models/zmodels.go registers it. Cross-package FKs (wizards) use sdk.Many2One[sdk.Any] plus comodel=.

addons/my_module/models/models.go
go
package models import (	"sumeru/core/sdk") // MyModule is the primary record for My Module.type MyModule struct {	sdk.Model `sumeru:"model=my.module"` 	Name        sdk.String  `sumeru:"required,index,string=Name"`	Description sdk.Text    `sumeru:"string=Description"`	Active      sdk.Boolean `sumeru:"default=true,string=Active"`	Sequence    sdk.Integer `sumeru:"default=10,string=Sequence"`}

Field types

ConstantWire valueUse
CharcharShort string
TexttextLong text
IntegerintegerWhole number
FloatfloatFloating point
NumericnumericExact decimal (money)
BooleanbooleanTrue/false
DatedateCalendar date
DateTimedatetimeTimestamp
SelectionselectionFixed key/label pairs
Many2Onemany2oneFK to another model
Many2Manymany2manyRelation table
One2Manyone2manyInverse of Many2One
JsonjsonJSON document

Computed fields

Register derived values with orm.RegisterCompute in core or addon init(). Computed fields are filled on read via ApplyComputes. This is not runtime model inheritance or automatic write-time recomputation — declare deps explicitly and keep logic in Go.

init.go
go
orm.RegisterCompute("sale.order", "amount_display", []string{"amount_total"},    func(ctx context.Context, rec map[string]interface{}) (interface{}, error) {        return fmt.Sprintf("%.2f", rec["amount_total"]), nil    })

FieldDefinition fields

FieldPurpose
NameColumn / field name
TypeOne of the FieldType constants
RequiredNOT NULL / required in UI
RelationTarget model for M2O / M2M / O2M
RelationTableJoin table name for M2M
Column1This model's FK column in the M2M table
Column2Target model's FK column in the M2M table
StringHuman label
DefaultValDefault value
Selection[][]string options: {{"key","Label"}, ...}
UniqueUnique constraint
IndexCreate a database index

Runtime records are maps

ORM reads and writes use map[string]interface{} keyed by field name (plus id). Schema sync follows generated model metadata from struct tags.

Compile and run

Terminal
shell
make generatego run . -- -c sumeru.conf -i my_module --stop-after-initmake run

Schema sync. Install/update syncs columns from FieldDefinition. Review migrations on shared databases. Sumeru is pre-alpha.

What not to do

  • Do not skip make generate after adding a model struct, and do not call RegisterModel in addon code.
  • Do not invent FieldType strings outside the constants above.
  • Do not put business logic that must survive restarts only in struct methods the ORM never calls.

Next step

Bind screens in Views & menus.