// FindWithLimit find the doucments for given query with limit
197134
func (s *DbSession) FindWithLimit(limit int, query Q, document Document) (interface{}, error) {
	fn := func(q *mgo.Query, result interface{}) error {
		return q.Limit(limit).All(result)
	}
	return s.executeFindAll(query, document, fn)
}
94958
func (q *Query) Limit(amount int) *Query {
	if amount < 0 {
		panic("Limit must be set to a positive number")
	}

	if q.limit != 0 {
		panic(fmt.Sprintf("Limit has already been set to %d", q.limit))
	}

	q.limit = amount

	return q
}
1176369
func (o *FindParams) WithXRateLimit(xRateLimit int32) *FindParams {
	o.SetXRateLimit(xRateLimit)
	return o
}
1170995
func (m *MockQuery) Limit(arg0 int) mongo.Query {
	ret := m.ctrl.Call(m, "Limit", arg0)
	ret0, _ := ret[0].(mongo.Query)
	return ret0
}
1261038
func (f *FilterOp) Limit(maxResults int) *FilterOp {
	f.LimitProp = &LimitFilter{Value: maxResults}
	return f
}
188517
func (q *Query) Limit(amount uint) *Query {
	q.query.Limit(amount)
	return q
}
881976
func (s *ListSizeConstraintSetsInput) SetLimit(v int64) *ListSizeConstraintSetsInput {
	s.Limit = &v
	return s
}
212060
func (l *limit) SetLimit(limit *sqlparser.Limit) error {
	count, ok := limit.Rowcount.(*sqlparser.SQLVal)
	if !ok {
		return fmt.Errorf("unexpected expression in LIMIT: %v", sqlparser.String(limit))
	}
	pv, err := sqlparser.NewPlanValue(count)
	if err != nil {
		return err
	}
	l.elimit.Count = pv

	switch offset := limit.Offset.(type) {
	case *sqlparser.SQLVal:
		pv, err = sqlparser.NewPlanValue(offset)
		if err != nil {
			return err
		}
		l.elimit.Offset = pv
	case nil:
		// NOOP
	default:
		return fmt.Errorf("unexpected expression in LIMIT: %v", sqlparser.String(limit))
	}

	l.input.SetUpperLimit(sqlparser.NewValArg([]byte(":__upper_limit")))
	return nil
}
1340008
func (_m *DBClient) IntervalsWithLimit(limit int) ([]models.Interval, error) {
	ret := _m.Called(limit)

	var r0 []models.Interval
	if rf, ok := ret.Get(0).(func(int) []models.Interval); ok {
		r0 = rf(limit)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]models.Interval)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(int) error); ok {
		r1 = rf(limit)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
110136
func (bldr *aeBackupInformationKindTypeInfoQueryBuilder) Limit(limit int) *aeBackupInformationKindTypeInfoQueryBuilder {
	bldr.q = bldr.q.Limit(limit)
	if bldr.plugin != nil {
		bldr.plugin.Limit(limit)
	}
	return bldr
}
464884
func IsLimitExceeded(data string) bool {
	data = strings.ToLower(data)
	return strings.Contains(data, "limit exceeded")
}
850749
func GenerateLimitQuery(selStmt sqlparser.SelectStatement) *sqlparser.ParsedQuery {
	buf := sqlparser.NewTrackedBuffer(nil)
	switch sel := selStmt.(type) {
	case *sqlparser.Select:
		limit := sel.Limit
		if limit == nil {
			sel.Limit = execLimit
			defer func() {
				sel.Limit = nil
			}()
		}
	case *sqlparser.Union:
		// Code is identical to *Select, but this one is a *Union.
		limit := sel.Limit
		if limit == nil {
			sel.Limit = execLimit
			defer func() {
				sel.Limit = nil
			}()
		}
	}
	buf.Myprintf("%v", selStmt)
	return buf.ParsedQuery()
}
117884
func (self Otto) ContextLimit(limit int) Context {
	return self.ContextSkip(limit, true)
}
1292590
func (bldr *iisQueryBuilder) Limit(limit int) *iisQueryBuilder {
	bldr.q = bldr.q.Limit(limit)
	if bldr.plugin != nil {
		bldr.plugin.Limit(limit)
	}
	return bldr
}
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
}
1147034
func (ref Reference) LimitToLast(limit int) Query {
	ref.limitToLast = limit
	return &ref
}
289766
func (e Output) WithLimit(n int) Output {
	e.limit = n
	return e
}