builder
builder copied to clipboard
Lightweight and fast SQL builder for Go language, moved to https://gitea.com/xorm/builder
代码: name := "cat;sleep(1)" build := builder.MySQL() sql, err := build.Select("*").From(table).Where(builder.Cond(builder.Eq{"name": name})).ToBoundSQL() 生成的sql语句是:SELECT * FROM t_tmp_info WHERE name='cat;sleep(1)' 并没有将sleep(1)过滤掉
Not entirely sure how the previous implementation was supposed to work. With SQL Server 2008 there is support for [OFFSET and FETCH clauses](https://docs.microsoft.com/en-us/sql/t-sql/queries/select-order-by-clause-transact-sql?view=sql-server-2017#using-offset-and-fetch-to-limit-the-rows-returned).
mysql: select * from user where name regexp '^tom'; postgresql: select * from user where name ~* '^[a-h]'
Cond interface needs iterator to edit the conditions. Suppose ID=10 is already given. If in some cases, we might change the ID=15. But Now we have to create new condition.