MCPcopy
hub / github.com/go-gorm/gorm / Where

Method Where

chainable_api.go:207–213  ·  view source on GitHub ↗

Where add conditions See the [docs] for details on the various formats that where clauses can take. By default, where clauses chain with AND. // Find the first user with name jinzhu db.Where("name = ?", "jinzhu").First(&user) // Find the first user with name jinzhu and age 20 db.Where(&User{Na

(query interface{}, args ...interface{})

Source from the content-addressed store, hash-verified

205//
206// [docs]: https://gorm.io/docs/query.html#Conditions
207func (db *DB) Where(query interface{}, args ...interface{}) (tx *DB) {
208 tx = db.getInstance()
209 if conds := tx.Statement.BuildCondition(query, args...); len(conds) > 0 {
210 tx.Statement.AddClause(clause.Where{Exprs: conds})
211 }
212 return
213}
214
215// Not add NOT conditions
216//

Callers

nothing calls this directly

Calls 3

getInstanceMethod · 0.95
BuildConditionMethod · 0.80
AddClauseMethod · 0.80

Tested by

no test coverage detected