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

Method Not

chainable_api.go:221–227  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

219// // Find the first user with name not equal to jinzhu
220// db.Not("name = ?", "jinzhu").First(&user)
221func (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//

Callers

nothing calls this directly

Calls 4

getInstanceMethod · 0.95
NotFunction · 0.92
BuildConditionMethod · 0.80
AddClauseMethod · 0.80

Tested by

no test coverage detected