本文整理匯總了Golang中github.com/cloudwan/gohan/schema.Manager.OrderedSchemas方法的典型用法代碼示例。如果您正苦於以下問題:Golang Manager.OrderedSchemas方法的具體用法?Golang Manager.OrderedSchemas怎麽用?Golang Manager.OrderedSchemas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudwan/gohan/schema.Manager
的用法示例。
在下文中一共展示了Manager.OrderedSchemas方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
Expect(db.CopyDBResources(inDB, outDB, true)).To(Succeed())
Expect(db.CopyDBResources(outDB, verifyDB, true)).To(Succeed())
inTx, err := inDB.Begin()
Expect(err).ToNot(HaveOccurred())
defer inTx.Close()
// SQL returns different types than JSON/YAML Database
// So we need to move it back again so that DeepEqual would work correctly
verifyTx, err := verifyDB.Begin()
Expect(err).ToNot(HaveOccurred())
defer verifyTx.Close()
for _, s := range manager.OrderedSchemas() {
if s.Metadata["type"] == "metaschema" {
continue
}
resources, _, err := inTx.List(s, nil, nil)
Expect(err).ToNot(HaveOccurred())
for _, inResource := range resources {
outResource, err := verifyTx.Fetch(s, transaction.Filter{"id": inResource.ID()})
Expect(err).ToNot(HaveOccurred())
Expect(outResource).To(Equal(inResource))
}
}
})
It("Should not override existing rows", func() {
inDB, err := db.ConnectDB("yaml", "test_data/conv_in.yaml", db.DefaultMaxOpenConn)