Skip to Content
fusion-orm
Models

Models

Defining models, the full fusion tag vocabulary, base models, naming, field types, and composite primary keys.

Models are plain Go structs. fusion-orm reflects each struct once into a cached *schema.Table — fields, primary keys, relations, hooks — and every query reuses that parse result. A fusion:"..." struct tag drives column names, constraints, indexes, and relations; a small set of field-name conventions (ID, CreatedAt, UpdatedAt, DeletedAt) work with no tag at all.

type crudUser struct {
	ID        int64 `fusion:"pk,autoincrement"`
	Name      string
	Age       int
	Email     string
	CreatedAt time.Time
	UpdatedAt time.Time
}

The tag vocabulary is a 1:1 migration from gorm:"...": both , and ; separate options, keys are normalized to lowercase, and unknown keys warn instead of failing unless Config.StrictTags is set.

In this section

On this page