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

Method Or

chainable_api.go:235–241  ·  view source on GitHub ↗

Or add OR conditions Or is used to chain together queries with an OR. // Find the first user with name equal to jinzhu or john db.Where("name = ?", "jinzhu").Or("name = ?", "john").First(&user)

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

Source from the content-addressed store, hash-verified

233// // Find the first user with name equal to jinzhu or john
234// db.Where("name = ?", "jinzhu").Or("name = ?", "john").First(&user)
235func (db *DB) Or(query interface{}, args ...interface{}) (tx *DB) {
236 tx = db.getInstance()
237 if conds := tx.Statement.BuildCondition(query, args...); len(conds) > 0 {
238 tx.Statement.AddClause(clause.Where{Exprs: []clause.Expression{clause.Or(clause.And(conds...))}})
239 }
240 return
241}
242
243// Joins specify Joins conditions
244//

Callers

nothing calls this directly

Calls 5

getInstanceMethod · 0.95
OrFunction · 0.92
AndFunction · 0.92
BuildConditionMethod · 0.80
AddClauseMethod · 0.80

Tested by

no test coverage detected