// Within returns true if the Date is within the Range - inclusive
15166
func (date Date) Within(term Range) bool {
	// Empty terms contain nothing
	if term.IsEmpty() {
		return false
	}
	// Only check if the range is bounded
	if !term.Start.IsZero() && date.Before(term.Start) {
		return false
	}
	if !term.End.IsZero() && date.After(term.End) {
		return false
	}
	return true
}
257647
func IsInRange(value int, min int, max int) []string {
	if value >= min && value <= max {
		return nil
	}
	return []string{InclusiveRangeError(min, max)}
}
1036364
func (b LocationBounds) Contains(loc Location) bool {
	if b.SpansDateLine() {
		return loc.Longitude >= b.West || loc.Longitude <= b.East
	}
	return loc.Longitude >= b.West && loc.Longitude <= b.East
}
1050071
func (qb *TiDBQueryBuilder) In(vals ...string) QueryBuilder {
	qb.Tokens = append(qb.Tokens, "IN", "(", strings.Join(vals, CommaSpace), ")")
	return qb
}
958324
func between(lhs Expression, rhs RangeVal) RangeExpression {
	return ranged{op: BETWEEN_OP, lhs: lhs, rhs: rhs}
}
1237865
func WeekdayInRange(t time.Time, minWeekday, maxWeekday time.Weekday) bool {
	return (minWeekday <= t.Weekday()) && (t.Weekday() <= maxWeekday)
}
774150
func (b *Bounding) Contains(c Comparable) bool {
	if b == nil {
		return true
	}
	for d := Dim(0); d < Dim(c.Dims()); d++ {
		if c.Compare(b[0], d) < 0 || c.Compare(b[1], d) > 0 {
			return false
		}
	}
	return true
}
469665
func (i Interval) InteriorContains(p float64) bool {
	if p == -math.Pi {
		p = math.Pi
	}
	if i.IsInverted() {
		return p > i.Lo || p < i.Hi
	}
	return (p > i.Lo && p < i.Hi) || i.IsFull()
}
539690
func MonthInRange(t time.Time, minMonth, maxMonth time.Month) bool {
	return (minMonth <= t.Month()) && (t.Month() <= maxMonth)
}
1204074
func (h *Handle) WithInstrumentation(yes bool) *Handle {
	h.instrument = yes
	return h
}
815908
func Within(c aspect.ColumnElem, s Shape) aspect.Clause {
	return aspect.FuncClause{
		Inner: aspect.ArrayClause{Clauses: []aspect.Clause{s, c}, Sep: ", "},
		F:     "ST_Within",
	}
}
211771
func (c *Criterion) In(values ...interface{}) *Query {
	c.operator = in
	c.inValues = values

	q := c.query
	q.fieldCriteria[q.currentField] = append(q.fieldCriteria[q.currentField], c)

	return q
}
1268992
func withinTimePeriod(start, end, now time.Time) bool {
	// Converts to UTC and only keeps the hour and minute info.
	start, end, now = start.UTC(), end.UTC(), now.UTC()
	start = time.Date(0, 0, 0, start.Hour(), start.Minute(), 0, 0, time.UTC)
	end = time.Date(0, 0, 0, end.Hour(), end.Minute(), 0, 0, time.UTC)
	now = time.Date(0, 0, 0, now.Hour(), now.Minute(), 0, 0, time.UTC)
	// for cases like from 00:00 to 06:00
	if end.Sub(start) >= 0 {
		return now.Sub(start) >= 0 && now.Sub(end) <= 0
	}
	// for cases like from 22:00 to 06:00
	return now.Sub(end) <= 0 || now.Sub(start) >= 0
}
723670
func (q *Query) WithInput(input *ast.Term) *Query {
	q.input = input
	return q
}
784785
func (d date) Date(year, month, day int, loc *time.Location) time.Time {
	return time.Date(year, time.Month(month), day, 12, 0, 0, 0, loc)
}
1283945
func within(parent, sub string) bool {
	rel, err := filepath.Rel(parent, sub)
	if err != nil {
		return false
	}
	return !strings.Contains(rel, "..")
}
1167022
func (r *Range) Empty() bool {
	return r.from == nil && r.to == nil
}