// YearInRange tests if a year of a time is in a given range.
180497
func YearInRange(t time.Time, minYear, maxYear int) bool {
	return (minYear <= t.Year()) && (t.Year() <= maxYear)
}
958324
func between(lhs Expression, rhs RangeVal) RangeExpression {
	return ranged{op: BETWEEN_OP, lhs: lhs, rhs: rhs}
}
498441
func EnumRange(db XODB, v0 pgtypes.Anyenum, v1 pgtypes.Anyenum, v2 pgtypes.Anyenum) (pgtypes.Anyarray, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.enum_range($1, $2, $3)`

	// run query
	var ret pgtypes.Anyarray
	XOLog(sqlstr, v0, v1, v2)
	err = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)
	if err != nil {
		return pgtypes.Anyarray{}, err
	}

	return ret, nil
}
626828
func StringRange(min, max int, charset string) (string, error) {
	//
	// First determine the length of string to be generated
	//
	var err error      // Holds errors
	var strlen int     // Length of random string to generate
	var randstr string // Random string to return
	strlen, err = IntRange(min, max)
	if err != nil {
		return randstr, err
	}
	randstr, err = String(strlen, charset)
	if err != nil {
		return randstr, err
	}
	return randstr, nil
}
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
}
676070
func DateRange(start, end time.Time) time.Time {
	return time.Unix(0, int64(Number(int(start.UnixNano()), int(end.UnixNano())))).UTC()
}
1203262
func (s *SourceInfo) SetRange(start, end int64) error {
	if start > end || start < 0 {
		return ErrInvalidArgument("start must be non-negative, and start must be at most end.")
	}
	// Note that 0 <= start <= end
	s.start, s.end = start, end
	return nil
}
53310
func (s *GetJobOutputInput) SetRange(v string) *GetJobOutputInput {
	s.Range = &v
	return s
}
868656
func NewRange(start, end Date) (term Range) {
	term.Start = start
	term.End = end
	return
}
1053351
func (tf tFiles) getRange(icmp *iComparer) (imin, imax internalKey) {
	for i, t := range tf {
		if i == 0 {
			imin, imax = t.imin, t.imax
			continue
		}
		if icmp.Compare(t.imin, imin) < 0 {
			imin = t.imin
		}
		if icmp.Compare(t.imax, imax) > 0 {
			imax = t.imax
		}
	}

	return
}
257647
func IsInRange(value int, min int, max int) []string {
	if value >= min && value <= max {
		return nil
	}
	return []string{InclusiveRangeError(min, max)}
}
1008049
func (tr Ranges) RemoveRange(r Range) Ranges {
	res := tr.clone()
	res.removeRangeInPlace(r)
	return res
}
193043
func (s *DateFilter) SetDateRange(v *DateRange) *DateFilter {
	s.DateRange = v
	return s
}
1209555
func (b *Bitmap) SliceRange(start, end uint64) []uint64 {
	var a []uint64
	itr := b.Iterator()
	itr.Seek(start)
	for v, eof := itr.Next(); !eof && v < end; v, eof = itr.Next() {
		a = append(a, v)
	}
	return a
}
1018606
func Range(start, end int) []float64 {
	size := end - start
	incr := true
	if start > end {
		incr = false
		size = start - end
	}

	if size < 0 {
		panic("Cannot create a float range that is negative in size")
	}

	r := make([]float64, size)
	for i, v := 0, float64(start); i < size; i++ {
		r[i] = v

		if incr {
			v++
		} else {
			v--
		}
	}
	return r
}
1181841
func YearInList(t time.Time, years []int) bool {
	for _, year := range years {
		if t.Year() == year {
			return true
		}
	}

	return false
}
382926
func (s *UploadMultipartPartInput) SetRange(v string) *UploadMultipartPartInput {
	s.Range = &v
	return s
}