We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原生SQL使用IN查询时,无法生成IN查询语句
例如:
sql := ` select * from test_table where id=? ` engine.SQL(sql).In(`in_cols`, cols).QueryString()
生成的SQL语句为:select * from test_table where id=?,并没有IN语句
select * from test_table where id=?
The text was updated successfully, but these errors were encountered:
@JasonkayZK In函数是ORM函数,SQL函数是RAW函数,两者是不能这样混用的
Sorry, something went wrong.
好的,这里也提供一种原生SQL使用IN操作的方法:
sql := ` ... ` if len(dictIds) > 0 { sql = sql + `and dictId in (` + strings.TrimRight(strings.Repeat(`?,`, len(dictIds)), `,`) + `)` for _, id := range dictIds { args = append(args, id) } }
No branches or pull requests
原生SQL使用IN查询时,无法生成IN查询语句
例如:
生成的SQL语句为:
select * from test_table where id=?
,并没有IN语句The text was updated successfully, but these errors were encountered: