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

Method Find

finisher_api.go:174–183  ·  view source on GitHub ↗

Find finds all records matching given conditions conds

(dest interface{}, conds ...interface{})

Source from the content-addressed store, hash-verified

172
173// Find finds all records matching given conditions conds
174func (db *DB) Find(dest interface{}, conds ...interface{}) (tx *DB) {
175 tx = db.getInstance()
176 if len(conds) > 0 {
177 if exprs := tx.Statement.BuildCondition(conds[0], conds[1:]...); len(exprs) > 0 {
178 tx.Statement.AddClause(clause.Where{Exprs: exprs})
179 }
180 }
181 tx.Statement.Dest = dest
182 return tx.callbacks.Query().Execute(tx)
183}
184
185// FindInBatches finds all records in batches of batchSize
186func (db *DB) FindInBatches(dest interface{}, batchSize int, fc func(tx *DB, batch int) error) *DB {

Callers

nothing calls this directly

Calls 5

getInstanceMethod · 0.95
BuildConditionMethod · 0.80
AddClauseMethod · 0.80
ExecuteMethod · 0.80
QueryMethod · 0.80

Tested by

no test coverage detected