BufPool WhereClause
This commit is contained in:
parent
5922dc89bd
commit
bd92e49ff0
1 changed files with 8 additions and 3 deletions
|
@ -300,12 +300,17 @@ func WhereClause(start int, cols []string) string {
|
|||
panic("0 is not a valid start number for whereClause")
|
||||
}
|
||||
|
||||
ret := make([]string, len(cols))
|
||||
buf := GetBuffer()
|
||||
defer PutBuffer(buf)
|
||||
|
||||
for i, c := range cols {
|
||||
ret[i] = fmt.Sprintf(`"%s"=$%d`, c, start+i)
|
||||
buf.WriteString(fmt.Sprintf(`"%s"=$%d`, c, start+i))
|
||||
if i < len(cols)-1 {
|
||||
buf.WriteString(" AND ")
|
||||
}
|
||||
}
|
||||
|
||||
return strings.Join(ret, " AND ")
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// DriverUsesLastInsertID returns whether the database driver supports the
|
||||
|
|
Loading…
Add table
Reference in a new issue