Not add NOT conditions Not works similarly to where, and has the same syntax. // Find the first user with name not equal to jinzhu db.Not("name = ?", "jinzhu").First(&user)
(query interface{}, args ...interface{})
| 219 | // // Find the first user with name not equal to jinzhu |
| 220 | // db.Not("name = ?", "jinzhu").First(&user) |
| 221 | func (db *DB) Not(query interface{}, args ...interface{}) (tx *DB) { |
| 222 | tx = db.getInstance() |
| 223 | if conds := tx.Statement.BuildCondition(query, args...); len(conds) > 0 { |
| 224 | tx.Statement.AddClause(clause.Where{Exprs: []clause.Expression{clause.Not(conds...)}}) |
| 225 | } |
| 226 | return |
| 227 | } |
| 228 | |
| 229 | // Or add OR conditions |
| 230 | // |
nothing calls this directly
no test coverage detected