本文整理匯總了Golang中github.com/eaciit/dbox.NewFilterBuilder函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewFilterBuilder函數的具體用法?Golang NewFilterBuilder怎麽用?Golang NewFilterBuilder使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewFilterBuilder函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewConnection
func NewConnection(ci *dbox.ConnectionInfo) (dbox.IConnection, error) {
if ci.Settings == nil {
ci.Settings = toolkit.M{}
}
c := new(Connection)
c.SetInfo(ci)
c.SetFb(dbox.NewFilterBuilder(new(FilterBuilder)))
return c, nil
}
示例2: TestFilter
func TestFilter(t *testing.T) {
fb := dbox.NewFilterBuilder(new(FilterBuilder))
fb.AddFilter(dbox.Or(
dbox.Eq("_id", 1),
dbox.Eq("group", "administrators")))
b, e := fb.Build()
if e != nil {
t.Errorf("Error %s", e.Error())
} else {
fmt.Printf("Result:\n%v\n", toolkit.JsonString(b))
}
}
示例3: TestFilter
func TestFilter(t *testing.T) {
fb := dbox.NewFilterBuilder(new(FilterBuilder))
fb.AddFilter(dbox.Or(
dbox.Contains("regfield", "1"),
dbox.Ne("nefield", 1),
dbox.Eq("group", "administrators")))
b, e := fb.Build()
if e != nil {
t.Errorf("Error %s", e.Error())
} else {
fmt.Printf("Result:\n%v\n", toolkit.JsonString(b))
}
fb = dbox.NewFilterBuilder(new(FilterBuilder))
fb.AddFilter(dbox.And(dbox.Or(dbox.Eq("EmployeeId", "101-102-10"), dbox.Eq("EmployeeId", "101-102-3"), dbox.Eq("EmployeeId", "101-102-4")), dbox.Eq("Age", "30")))
c, e := fb.Build()
if e != nil {
t.Errorf("Error %s", e.Error())
} else {
fmt.Printf("Result:\n%v\n", toolkit.JsonString(c))
}
}