Skip to content

Commit 567ea02

Browse files
committed
fix #229: update doc on Where to avoid confusion
1 parent 21cf114 commit 567ea02

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

delete.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ func (db *DeleteBuilder) TableNames() []string {
125125
return tableNames
126126
}
127127

128-
// Where sets expressions of WHERE in DELETE.
128+
// Where adds expressions to the WHERE clause in DELETE.
129+
//
130+
// Multiple calls to Where will join expressions with AND.
131+
// To reset the WHERE clause, set the WhereClause field to nil.
129132
func (db *DeleteBuilder) Where(andExpr ...string) *DeleteBuilder {
130133
if len(andExpr) == 0 || estimateStringsBytes(andExpr) == 0 {
131134
return db

select.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ func (sb *SelectBuilder) JoinWithOption(option JoinOption, table string, onExpr
205205
return sb
206206
}
207207

208-
// Where sets expressions of WHERE in SELECT.
208+
// Where adds expressions to the WHERE clause in SELECT.
209+
//
210+
// Multiple calls to Where will join expressions with AND.
211+
// To reset the WHERE clause, set the WhereClause field to nil.
209212
func (sb *SelectBuilder) Where(andExpr ...string) *SelectBuilder {
210213
if len(andExpr) == 0 || estimateStringsBytes(andExpr) == 0 {
211214
return sb

update.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ func (ub *UpdateBuilder) SetMore(assignment ...string) *UpdateBuilder {
140140
return ub
141141
}
142142

143-
// Where sets expressions of WHERE in UPDATE.
143+
// Where adds expressions to the WHERE clause in UPDATE.
144+
//
145+
// Multiple calls to Where will join expressions with AND.
146+
// To reset the WHERE clause, set the WhereClause field to nil.
144147
func (ub *UpdateBuilder) Where(andExpr ...string) *UpdateBuilder {
145148
if len(andExpr) == 0 || estimateStringsBytes(andExpr) == 0 {
146149
return ub

0 commit comments

Comments
 (0)