Comments (4)
不好意思,不知道怎么格式化代码。
from gorose.
这样的吧, markdown语法, 你可以看下代码块的用法就可以了, 非常简单, 就每行3个反引号, 在两行反引号之间写代码就可以了
func (this *DemoModel) List() (int, []map[string]interface{}, error) {
userM := this.GetTable()
count, err := userM.Count("*")
result, err := userM.OrWhere("name", "not in", []string{"小米"}).Get()
//这里报错
lastsql := db.LastSql()
log.Debug(lastsql)
if (err != nil) {
return 0, result, err
}
this.UseGetter(result)
return count, result, nil
}
from gorose.
@caoyanbin1993
OrWhere()
用法
OrWhere("id", "not in", []interface{}{"3"})
这里的第三个参数要用 interface 切片数组, 为了兼容 字符串, 数字等情况
另外, Get()
的返回是 []map[string]interface {}
, 所以, 你用她的数据的时候, 在遇到 interface{} 时, 需要指定他的类型
from gorose.
通过修改collection.Colunm的返回类型,避免了上述错误,谢谢飞哥。
from gorose.
Related Issues (20)
- preceding tag (v0.0.3-rc) not found HOT 1
- 当 IN 查询的条件为空数组时报错
- 提供 IfEnableSqlLog() 功能
- runtime error: invalid memory address or nil pointer dereference in driver.Open
- 结构体继承之后再进行映射会有问题
- 是否考虑引入Finisher方法的概念
- 在使用 engin.SetLogger(Logger) 的时候报错,期望官方的 type ILogger interface 支持 go.uber.org/zap
- 为什么批量写入会出错,将multi_data 的数据删除一条,成功执行
- 使用 insert对ClickHouse进行新增操作 ,插入一条数据成功后,拿不到count,而且err!=nil
- 这个没办法手动设置要查询的数据库么?
- 这个框架还在更新么?结构体字段支持map、slice或自定义结构体么 HOT 1
- 想要在日志里记录trace/request id HOT 1
- Prefix 问题 HOT 1
- json_contains(contactIdList,38710)
- transaction中使用select()会造成执行结果无法写回映射对象
- Execute无法执行lock tables 之类的sql HOT 2
- Execute无法执行lock tables 之类的sql HOT 1
- 如何实现多个数据库之前的切换使用
- Where编译时bool参数的问题
- panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1002959f9] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gorose.