// limit returns a scope that limits the results.
542889
func limit(limit int) scope {
	return scopeFunc(func(db *gorm.DB) *gorm.DB {
		return db.Limit(limit)
	})
}
47060
func (f scopeFunc) scope(db *gorm.DB) *gorm.DB {
	return f(db)
}
866028
func (p *pathObject) GetLimit(limit int) error {
	it := p.buildIteratorTree()
	it.Tagger().Add(TopResultTag)
	p.s.limit = limit
	p.s.count = 0
	return p.s.runIterator(it)
}
1334845
func limitMap(i interface{}, limit int) {
	m, ok := i.(map[chainhash.Hash]struct{})
	if ok {
		if len(m)+1 > limit {
			// Remove a random entry from the map.  For most compilers, Go's
			// range statement iterates starting at a random item although
			// that is not 100% guaranteed by the spec.  The iteration order
			// is not important here because an adversary would have to be
			// able to pull off preimage attacks on the hashing function in
			// order to target eviction of specific entries anyways.
			for txHash := range m {
				delete(m, txHash)
				return
			}
		}
		return
	}
	n, ok := i.(map[chainhash.Hash]uint32)
	if ok {
		if len(n)+1 > limit {
			for txHash := range n {
				delete(n, txHash)
				return
			}
		}
	}
}
1126813
func (bldr *aeBackupKindQueryBuilder) Limit(limit int) *aeBackupKindQueryBuilder {
	bldr.q = bldr.q.Limit(limit)
	if bldr.plugin != nil {
		bldr.plugin.Limit(limit)
	}
	return bldr
}
1115760
func newLimitRanges(c *CoreClient, namespace string) *limitRanges {
	return &limitRanges{
		client: c,
		ns:     namespace,
	}
}
93676
func validateLimit(v, min, max int) error {

	// ensure the value for `limit` is valid
	if v < min || v > max {
		err := fmt.Errorf("%d is not a valid value for `limit`, must be between %d-%d (inclusive).", v, min, max)
		return err
	}

	return nil
}
888759
func (c *BotTasksCall) Limit(limit int64) *BotTasksCall {
	c.urlParams_.Set("limit", fmt.Sprint(limit))
	return c
}
1177016
func (bldr *SampleQueryBuilder) Limit(limit int) *SampleQueryBuilder {
	bldr.q = bldr.q.Limit(limit)
	if bldr.plugin != nil {
		bldr.plugin.Limit(limit)
	}
	return bldr
}
854674
func (q *TransactionQuery) Limit(amount uint) *TransactionQuery {
	q.query.Limit(amount)
	return q
}
334181
func (c *UsersListCall) Limit(limit int) *UsersListCall {
	c.limit = limit
	return c
}
198048
func (me *Dataset) Limit(limit uint) *Dataset {
	ret := me.copy()
	if limit > 0 {
		ret.clauses.Limit = limit
	} else {
		ret.clauses.Limit = nil
	}
	return ret
}
825371
func Limit(limit int) func(*index.Options) {
	return func(opts *index.Options) {
		opts.Limit = limit
	}
}
475691
func (o querySet) Limit(limit interface{}, args ...interface{}) QuerySeter {
	o.limit = ToInt64(limit)
	if len(args) > 0 {
		o.setOffset(args[0])
	}
	return &o
}
988743
func queryLimit(query url.Values, name string, def int) (int, error) {
	str := query.Get(name)
	if str == "" {
		return def, nil
	}
	limit, err := strconv.Atoi(str)
	if err != nil {
		return 0, trace.BadParameter("failed to parse %v as limit: %v", name, str)
	}
	return limit, nil
}
350512
func (c *Connection) Limit(limit int) *Query {
	return Q(c).Limit(limit)
}
942350
func (s composedScope) scope(db *gorm.DB) *gorm.DB {
	for _, s := range s {
		db = s.scope(db)
	}

	return db
}