Files
go-admin/common/models/type.go
T
zhangwenjian 2840010dfd refactor🎨: turn common/models into a thin alias of go-admin-core
ControlBy, Model, ModelTime, ActiveRecord, BaseUser, Response, Page,
Migration and the menu type constants now read `type X = pkg.X` /
`const X = pkg.X` against go-admin-core's sdk/contract/models instead
of defining these shapes locally. Every embed, GORM tag and JSON tag
is unchanged - a type alias is the same type, not a new one - and
every existing import of go-admin/common/models keeps compiling with
no changes of its own (verified with `git diff --exit-code` over the
70 files that import common/models, common/dto or common/actions).

The menu type constants (Directory/Menu/Button) are declared as direct
references rather than restated literals: an independently written
copy of the same value can be edited out of step with go-admin-core's,
where a direct reference cannot (PRD 006 hard constraint 4).

PRD 006 F1/F5.

Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx
2026-09-05 10:15:51 +08:00

13 lines
625 B
Go

package models
import contractmodels "github.com/go-admin-team/go-admin-core/v2/sdk/contract/models"
// ActiveRecord is self-referencing (Generate() ActiveRecord), which is why
// it must stay a type alias rather than a defined type: aliasing preserves
// identity with go-admin-core's sdk/contract/models.ActiveRecord, so a
// model whose Generate() returns that interface still satisfies this one. A
// defined type here would break every implementer's method set - see
// go-admin-core's sdk/contract/models package tests for the counterproof
// (PRD 006 counterproof A).
type ActiveRecord = contractmodels.ActiveRecord