feat(orm): ModuleDB JSON import/export/default/validate methods (#11101)

* feat(orm): ModuleDB JSON methods

* WIP

* WIP on JSON

* WIP

* WIP

* tests and docs

* revert

* tests and docs

* docs

* address review comments
This commit is contained in:
Aaron Craelius
2022-02-03 20:36:21 -08:00
committed by GitHub
parent 888548ab53
commit 37ae08d92a
26 changed files with 393 additions and 45 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ func (s singletonGen) genMethods() {
func (s singletonGen) genConstructor() {
iface := s.messageStoreInterfaceName(s.msg)
s.P("func New", iface, "(db ", ormdbPkg.Ident("ModuleDB"), ") (", iface, ", error) {")
s.P("func New", iface, "(db ", ormTablePkg.Ident("Schema"), ") (", iface, ", error) {")
s.P("table := db.GetTable(&", s.msg.GoIdent.GoName, "{})")
s.P("if table == nil {")
s.P("return nil, ", ormErrPkg.Ident("TableNotFound.Wrap"), "(string((&", s.msg.GoIdent.GoName, "{}).ProtoReflect().Descriptor().FullName()))")