// Range returns range from origin, reverts to fallback if origin fails
769200
func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) {
	sourceRows, sourceToken, sourceErr := c.Next.Range(ctx, ei, columnConditions, dosa.All(), token, limit)
	if !c.isCacheable(ei) || dosa.ErrorIsNotFound(sourceErr) {
		return sourceRows, sourceToken, sourceErr
	}
	cacheKey := rangeQuery{
		Conditions: dosa.NormalizeConditions(columnConditions),
		Token:      token,
		Limit:      limit,
	}
	rangeResult := rangeResults{
		TokenNext: sourceToken,
		Rows:      sourceRows,
	}

	if sourceErr == nil {
		w := func() error {
			return c.writeKeyValueToFallback(ctx, ei, cacheKey, rangeResult)
		}
		_ = c.cacheWrite(w)

		return sourceRows, sourceToken, sourceErr
	}

	value, err := c.getValueFromFallback(ctx, ei, cacheKey)
	c.logFallback("RANGE", ei.Def.Name, err)
	if err != nil {
		return sourceRows, sourceToken, sourceErr
	}
	unpack := rangeResults{}
	err = c.encoder.Decode(value, &unpack)
	if err != nil {
		return sourceRows, sourceToken, sourceErr
	}

	return rawRowsAsPointers(ei, unpack.Rows), unpack.TokenNext, err
}
14799
func FullRange() []*Range {
	return []*Range{{LowVal: []types.Datum{{}}, HighVal: []types.Datum{types.MaxValueDatum()}}}
}
211644
func (f *FilterOp) Range(field string, gte interface{},
	gt interface{}, lte interface{}, lt interface{}, timeZone string) *FilterOp {

	if f.RangeMap == nil {
		f.RangeMap = make(map[string]RangeFilter)
	}

	f.RangeMap[field] = RangeFilter{
		Gte:      gte,
		Gt:       gt,
		Lte:      lte,
		Lt:       lt,
		TimeZone: timeZone}

	return f
}
562026
func inRange(r headerutil.Range) scope {
	var scope composedScope

	if r.Max != nil {
		scope = append(scope, limit(*r.Max))
	}

	if r.Sort != nil && r.Order != nil {
		o := fmt.Sprintf("%s %s", *r.Sort, *r.Order)
		scope = append(scope, order(o))
	}

	return scope
}
854991
func inRange(x, a, b token.Position) bool {
	if !util.PathEqual(x.Filename, a.Filename) || !util.PathEqual(x.Filename, b.Filename) {
		return false
	}
	return x.Offset >= a.Offset && x.Offset <= b.Offset
}
517362
func (r Range) String() string {
	return fmt.Sprintf("(%v,%v)", r.Start, r.End)
}
603688
func NewRanges(ns ...uint64) Ranges {
	xs := append(uint64s{}, ns...)
	sort.Sort(xs)
	rs := make(Ranges, len(xs))
	for i := range xs {
		rs[i].Begin, rs[i].End = xs[i], xs[i]
	}
	return rs.Squash()
}
1286110
func (t *ImmutableTree) IterateRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) (stopped bool) {
	if t.root == nil {
		return false
	}
	return t.root.traverseInRange(t, start, end, ascending, false, 0, func(node *Node, _ uint8) bool {
		if node.height == 0 {
			return fn(node.key, node.value)
		}
		return false
	})
}
153220
func (c *Container) countRange(start, end int32) (n int32) {
	if c.isArray() {
		return c.arrayCountRange(start, end)
	} else if c.isRun() {
		return c.runCountRange(start, end)
	}
	return c.bitmapCountRange(start, end)
}
1313411
func (g *Group) Range() *Statement {
	// notest
	s := Range()
	g.items = append(g.items, s)
	return s
}
92080
func (tr Ranges) clone() Ranges {
	res := Ranges{sortedRanges: list.New()}
	if tr.sortedRanges == nil {
		return res
	}
	for e := tr.sortedRanges.Front(); e != nil; e = e.Next() {
		res.sortedRanges.PushBack(e.Value.(Range))
	}
	return res
}
1095324
func (r *Range) String() string {
	switch {
	case r.from == nil && r.to == nil:
		return ""
	case r.from == nil:
		return fmt.Sprintf("-%d", *r.to)
	case r.to == nil:
		return fmt.Sprintf("%d-", *r.from)
	case *r.from == *r.to:
		return fmt.Sprintf("%d", *r.to)
	default:
		return fmt.Sprintf("%d-%d", *r.from, *r.to)
	}
}
1332486
func Range(a, b int) VertexSet {
	if a >= b {
		return empty()
	}
	return VertexSet{[]interval{{a, b, 0}}}
}
511078
func NewRangeFrom(from int) (*Range, error) {
	return (&rangeBuilder{}).from(from, nil).Range()
}
1301880
func (s *HyperParameterSpecification) SetRange(v *ParameterRange) *HyperParameterSpecification {
	s.Range = v
	return s
}
680806
func StatusRange(start, end int) *Mux {
	return Match(func(ctx *c.Context) bool {
		return ctx.GetString("$phase") == "response" && ctx.Response.StatusCode >= start && ctx.Response.StatusCode <= end
	})
}
828359
func (v Value) InRange(a, b Value) bool {
	return v-a < b-a
}