-
Notifications
You must be signed in to change notification settings - Fork 0
ORM and entity registration
Derevtsov Konstantin edited this page Jul 22, 2020
·
6 revisions
A top-level object in d3 infrastructure is orm.Orm instance. Orm controls lower-level objects (like sessions or repositories). Before D3 will manage some type of entity, it requires to register this type.
Here is an example of creating Orm instance and register "User" entity:
d3orm := orm.NewOrm(someDriver)
if err = d3orm.Register((*User)(nil)); err != nil {
log.Fatal(err)
}
Note, before register entity you need to generate boilerplate code for this entity by d3 tool.