go语言调用不通包下的函数报错

栏目: Go · 发布时间: 5年前

controller包下: func (c *Area)List() { id, _ := c.GetInt("parent_id") //查询 where := make(map[string]interface{}) where["parent_id"] = id //初始化 mod := admin.NewAreaService() //查询 page, _ := c.GetInt("page") data, err := model.GetAll(where, []string{}, "id ASC", page, 999) if err != nil { fmt.Println(err.Error()) c.Error(err.Error()) return } c.Data["data"] = data //扩展查询 ext := admin.NewAreaExtService() data_ext, err := ext.GetAll(where, []string{}, "id ASC,ext_id ASC", page, 999) if err != nil { c.Error(err.Error()) return } c.Data["data_ext"] = data_ext c.Data["title"] = "地区-列表" c.TplName = "admin/areast.html" } model包下: func (c *Area) GetAll(q map[string]interface{}, fields []string, orderBy string, page int, limit int) (*db.Paginator, error) { session := db.Filter(q) count, err := session.Count(c) if err != nil { fmt.Println(err) return nil,fox.NewError( err.Error()) } Query := db.Pagination(int(count), page, limit) if count == 0 { return Query, nil } session = db.Filter(q) if orderBy != "" { session.OrderBy(orderBy) } session.Limit(limit, Query.Offset) if len(fields) == 0 { session.AllCols() } data := c.newMakeDataArr() err = session.Find(&data) if err != nil { fmt.Println(err) return nil,fox.NewError( err.Error()) } Query.Data = make([]interface{}, len(data)) for y, x := range data { Query.Data[y] = x } return Query, nil } 编译错误: F:\jgn02\src\blog>go build main.go # blog/controllers/admin controllers\admin\area.go:26:15: undefined: model


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

HTTP Developer's Handbook

HTTP Developer's Handbook

Chris Shiflett / Sams Publishing / 2003-3-29 / USD 39.99

The largest group with an unsatisfied demand for a good book on HTTP is the worldwide group of Web developers. A good book on HTTP can help new and old Web developers alike, as a thorough understandin......一起来看看 《HTTP Developer's Handbook》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

SHA 加密
SHA 加密

SHA 加密工具