I have two tables: child and dog. The dog table contains a foreign key reference to the child table. I specify the id of a specific child when inserting a dog record. I don't know how to implement it. Does anyone know how to do it? Can you give me a sample program? Thanks
type child struct(
id int64 `orm:"pk;auto"`
name string
);
type dog struct(
id int64 `orm:"pk;auto"`
dog string
child *child `orm:"rel(fk);null;on_delete(set_null)"`
);
Comments
Post a Comment