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

Method Limit

chainable_api.go:343–347  ·  view source on GitHub ↗

Limit specify the number of records to be retrieved Limit conditions can be cancelled by using `Limit(-1)`. // retrieve 3 users db.Limit(3).Find(&users) // retrieve 3 users into users1, and all users into users2 db.Limit(3).Find(&users1).Limit(-1).Find(&users2)

(limit int)

Source from the content-addressed store, hash-verified

341// // retrieve 3 users into users1, and all users into users2
342// db.Limit(3).Find(&users1).Limit(-1).Find(&users2)
343func (db *DB) Limit(limit int) (tx *DB) {
344 tx = db.getInstance()
345 tx.Statement.AddClause(clause.Limit{Limit: &limit})
346 return
347}
348
349// Offset specify the number of records to skip before starting to return the records
350//

Callers 4

FirstMethod · 0.95
TakeMethod · 0.95
LastMethod · 0.95
FirstOrInitMethod · 0.95

Calls 2

getInstanceMethod · 0.95
AddClauseMethod · 0.80

Tested by

no test coverage detected