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
Defining models
Struct-to-table mapping, tag-free conventions, embedded structs, and ignored fields.
Tag reference
Every fusion:"..." key, its aliases, and its exact semantics.
Base models
fusion.Model and fusion.UUIDModel: timestamps, soft delete, UUIDv7 keys.
Naming strategy
Pluralized snake_case, initialisms, prefixes, and the Namer interface.
Field types & serializers
Go-type to SQL-type mapping per dialect, and the JSON serializer.
Composite primary keys
Multi-column keys: tuple matching, keyset pagination, and inference limits.