本文整理汇总了Golang中github.com/zhgo/web.Fail函数的典型用法代码示例。如果您正苦于以下问题:Golang Fail函数的具体用法?Golang Fail怎么用?Golang Fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fail函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Render
func (c *MrkPromotionList) Render() web.Result {
d := []ent.MrkPromotion{}
q := biz.MrkPromotion.Select()
err := q.Parse(c.Cond).Rows(&d)
if err != nil {
return web.Fail(err)
}
return web.Done(d)
}
示例2: Render
func (c *WhlOrderSkuList) Render() web.Result {
d := []ent.WhlOrderSku{}
q := biz.WhlOrderSku.Select()
err := q.Parse(c.Cond).Rows(&d)
if err != nil {
return web.Fail(err)
}
return web.Done(d)
}
示例3: Render
func (c *PimProductList) Render() web.Result {
d := []ent.PimProduct{}
q := biz.PimProduct.Select()
err := q.Parse(c.Cond).Rows(&d)
if err != nil {
return web.Fail(err)
}
return web.Done(d)
}
示例4: Render
func (c *InvLogList) Render() web.Result {
d := []ent.InvLog{}
q := biz.InvLog.Select()
err := q.Parse(c.Cond).Rows(&d)
if err != nil {
return web.Fail(err)
}
return web.Done(d)
}
示例5: Render
func (c *SrmSupplierList) Render() web.Result {
d := []ent.SrmSupplier{}
q := biz.SrmSupplier.Select()
err := q.Parse(c.Cond).Rows(&d)
if err != nil {
return web.Fail(err)
}
return web.Done(d)
}
示例6: Render
func (c *EntitySearch) Render() web.Result {
if c.EntityType == "" {
return web.Fail(errors.New("entity_type can not be empty"))
}
// Load entity map from yaml or json format.
entity, ok := maps[c.EntityType]
if !ok {
return web.Fail(errors.New("entity_type configuration not found"))
}
// Replace query.
conds := make([]string, len(c.Conditions))
if len(c.Conditions) > 0 {
for k, v := range c.Conditions {
var ok bool
f, ok := entity[k]
if !ok {
return web.Fail(errors.New("field not found"))
}
conds = append(conds, f.Name+":"+v)
}
} else {
conds = append(conds, "*:*")
}
// Build a query object
// Here we are specifying a 'q' param,
// rows, faceting and facet.fields
q := solr.Query{
Params: solr.URLParamMap{
"q": conds,
//"facet.field": []string{"accepts_4x4s", "accepts_bicycles"},
//"facet": []string{"true"},
},
Rows: 30,
}
// perform the query, checking for errors
res, err := solrObj.Select(&q)
if err != nil {
log.Fatal(err)
}
// grab results for ease of use later on
results := res.Results
//log.Printf("%#v\n", q)
//log.Printf("%#v\n", res)
//log.Printf("%#v\n", results)
rows := make([]map[string]string, 0)
for i := 0; i < results.Len(); i++ {
id := fmt.Sprintf("%#v", results.Get(i).Field("id__i"))
name := fmt.Sprintf("%#v", results.Get(i).Field("name"))
url := fmt.Sprintf("%#v", results.Get(i).Field("url"))
address := fmt.Sprintf("%#v", results.Get(i).Field("address"))
description := fmt.Sprintf("%#v", results.Get(i).Field("description"))
menus__json := fmt.Sprintf("%#v", results.Get(i).Field("menus__json"))
features := fmt.Sprintf("%#v", results.Get(i).Field("features"))
class_feature__ss := fmt.Sprintf("%#v", results.Get(i).Field("class_feature__ss"))
halls__json := fmt.Sprintf("%#v", results.Get(i).Field("halls__json"))
service__json := fmt.Sprintf("%#v", results.Get(i).Field("service__json"))
data := make(map[string]string)
data["id"] = id
data["name"] = name
data["url"] = url
data["address"] = address
data["description"] = description
data["menus__json"] = menus__json
data["features"] = features
data["class_feature__ss"] = class_feature__ss
data["halls__json"] = halls__json
data["service__json"] = service__json
rows = append(rows, data)
}
return web.Done(rows)
}