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{})
| 205 | // |
| 206 | // [docs]: https://gorm.io/docs/query.html#Conditions |
| 207 | func (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 | // |
nothing calls this directly
no test coverage detected