1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-14 01:31:02 +00:00

add 'FOR UPDATE' support for querySet

This commit is contained in:
hurisheng
2018-06-23 22:25:05 +08:00
parent f16688817a
commit fc2c96a177
3 changed files with 25 additions and 10 deletions

View File

@ -969,6 +969,10 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi
}
query := fmt.Sprintf("%s %s FROM %s%s%s T0 %s%s%s%s%s", sqlSelect, sels, Q, mi.table, Q, join, where, groupBy, orderBy, limit)
if qs.forupdate {
query += " FOR UPDATE"
}
d.ins.ReplaceMarks(&query)
var rs *sql.Rows