fix #229: update doc on Where to avoid confusion

This commit is contained in:
Huan Du
2026-01-20 11:48:29 +08:00
parent 22ee7f6fa6
commit 053369bda3
3 changed files with 12 additions and 3 deletions
+4 -1
View File
@@ -125,7 +125,10 @@ func (db *DeleteBuilder) TableNames() []string {
return tableNames
}
// Where sets expressions of WHERE in DELETE.
// Where adds expressions to the WHERE clause in DELETE.
//
// Multiple calls to Where will join expressions with AND.
// To reset the WHERE clause, set the WhereClause field to nil.
func (db *DeleteBuilder) Where(andExpr ...string) *DeleteBuilder {
if len(andExpr) == 0 || estimateStringsBytes(andExpr) == 0 {
return db
+4 -1
View File
@@ -205,7 +205,10 @@ func (sb *SelectBuilder) JoinWithOption(option JoinOption, table string, onExpr
return sb
}
// Where sets expressions of WHERE in SELECT.
// Where adds expressions to the WHERE clause in SELECT.
//
// Multiple calls to Where will join expressions with AND.
// To reset the WHERE clause, set the WhereClause field to nil.
func (sb *SelectBuilder) Where(andExpr ...string) *SelectBuilder {
if len(andExpr) == 0 || estimateStringsBytes(andExpr) == 0 {
return sb
+4 -1
View File
@@ -140,7 +140,10 @@ func (ub *UpdateBuilder) SetMore(assignment ...string) *UpdateBuilder {
return ub
}
// Where sets expressions of WHERE in UPDATE.
// Where adds expressions to the WHERE clause in UPDATE.
//
// Multiple calls to Where will join expressions with AND.
// To reset the WHERE clause, set the WhereClause field to nil.
func (ub *UpdateBuilder) Where(andExpr ...string) *UpdateBuilder {
if len(andExpr) == 0 || estimateStringsBytes(andExpr) == 0 {
return ub