// Limit sets the value for optional limit parameter
334181
func (c *UsersListCall) Limit(limit int) *UsersListCall {
	c.limit = limit
	return c
}
979805
func (s *FilterLogEventsInput) SetLimit(v int64) *FilterLogEventsInput {
	s.Limit = &v
	return s
}
475691
func (o querySet) Limit(limit interface{}, args ...interface{}) QuerySeter {
	o.limit = ToInt64(limit)
	if len(args) > 0 {
		o.setOffset(args[0])
	}
	return &o
}
1355352
func (p *queryPlan) limit() {
	if p.stm.IsLimitSet() {
		tracer.Trace(p.tracer, func() []string {
			return []string{"Limit results to " + strconv.Itoa(int(p.stm.Limit()))}
		})
		p.tbl.Limit(p.stm.Limit())
	}
}
862652
func (rl *RateLimiter) Limit() bool {
	// Calculate the number of ns that have passed since our last call
	now := unixNano()
	passed := now - atomic.SwapUint64(&rl.lastCheck, now)

	// Add them to our allowance
	rate := atomic.LoadUint64(&rl.rate)
	current := atomic.AddUint64(&rl.allowance, passed*rate)

	// Ensure our allowance is not over maximum
	if max := atomic.LoadUint64(&rl.max); current > max {
		atomic.AddUint64(&rl.allowance, max-current)
		current = max
	}

	// If our allowance is less than one unit, rate-limit!
	if current < rl.unit {
		return true
	}

	// Not limited, subtract a unit
	atomic.AddUint64(&rl.allowance, -rl.unit)
	return false
}
626950
func (o *FindParams) WithLimit(limit int32) *FindParams {
	o.SetLimit(limit)
	return o
}
862270
func (i *InteractionRestriction) GetLimit() string {
	if i == nil || i.Limit == nil {
		return ""
	}
	return *i.Limit
}
788660
func (s *SortCommand) Limit(offset, count int) *SortCommand {
	s.limit = true
	s.offset = offset
	s.count = count
	return s
}
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
}
536264
func (s *GetSdkTypesInput) SetLimit(v int64) *GetSdkTypesInput {
	s.Limit = &v
	return s
}
1292121
func Limit(limit int) DeviceRequestOption {
	return func(opts *deviceRequestOpts) error {
		if limit > 1000 {
			return fmt.Errorf("Limit must not be higher than 1000")
		}
		opts.Limit = limit
		return nil
	}
}
727981
func (l *Limiter) Allow(name string, maxn int64, period time.Duration) (count int64, delay time.Duration, allow bool) {
	return l.AllowN(name, maxn, period, 1)
}
1247618
func (q *BaseQueryBuilder) BuildLimit(limit int64, offset int64) string {
	if limit < 0 && offset > 0 {
		// most DBMS requires LIMIT when OFFSET is present
		limit = 9223372036854775807 // 2^63 - 1
	}

	sql := ""
	if limit >= 0 {
		sql = fmt.Sprintf("LIMIT %v", limit)
	}
	if offset <= 0 {
		return sql
	}
	if sql != "" {
		sql += " "
	}
	return sql + fmt.Sprintf("OFFSET %v", offset)
}
854674
func (q *TransactionQuery) Limit(amount uint) *TransactionQuery {
	q.query.Limit(amount)
	return q
}
930369
func (c *Collector) Limits(rules []*LimitRule) error {
	return c.backend.Limits(rules)
}
888759
func (c *BotTasksCall) Limit(limit int64) *BotTasksCall {
	c.urlParams_.Set("limit", fmt.Sprint(limit))
	return c
}
248544
func (t *Table) Limit(i int64) {
	t.mu.Lock()
	defer t.mu.Unlock()
	if int64(len(t.Data)) > i {
		td := make([]Row, i, i) // Preallocate resulting table.
		copy(td, t.Data[:i])
		t.Data = td
	}
}