// AddWhere adds the boolean expression to the
// WHERE clause as an AND condition. If the expression
// is an OR clause, it parenthesizes it. Currently,
// the OR operator is the only one that's lower precedence
// than AND.
497957
func (node *Select) AddWhere(expr Expr) {
	if _, ok := expr.(*OrExpr); ok {
		expr = &ParenExpr{Expr: expr}
	}
	if node.Where == nil {
		node.Where = &Where{
			Type: WhereStr,
			Expr: expr,
		}
		return
	}
	node.Where.Expr = &AndExpr{
		Left:  node.Where.Expr,
		Right: expr,
	}
}
731200
func whereAny(entries interface{}, key, sep string, cmp []string) (interface{}, error) {
	return generalizedWhere("whereAny", entries, key, func(value interface{}) bool {
		if value == nil {
			return false
		} else {
			items := strings.Split(value.(string), sep)
			return len(intersect(cmp, items)) > 0
		}
	})
}
763087
func (qs *QuadStore) AddValue(v quad.Value) (int64, bool) {
	id, exists := qs.resolveVal(v, true)
	return id, !exists
}
389634
func (s *service) AddWithProfile(reqDTO rest.RequestDTOWithProfile) (rest.ResponseDTOWithProfile, *servicehelper.Error) {
	if _, err := s.Add(rest.RequestDTO{
		Email:    reqDTO.Email,
		Username: reqDTO.Username,
		Password: reqDTO.Password,
	}); err != nil {
		return rest.ResponseDTOWithProfile{}, err
	}
	resDTO, apiErrors, statusCode := callPostProfileService(reqDTO)
	if statusCode != http.StatusCreated {
		s.Remove(reqDTO.Email)
		if len(apiErrors.Errors) > 0 {
			return rest.ResponseDTOWithProfile{}, &servicehelper.Error{
				Detail:  errors.New(apiErrors.Errors[0].(apihelper.Error).Detail),
				Message: apiErrors.Errors[0].(apihelper.Error).Message,
				Param:   apiErrors.Errors[0].(apihelper.Error).Param,
				Code:    servicehelper.Code(statusCode),
			}
		}
		return rest.ResponseDTOWithProfile{}, &servicehelper.Error{
			Detail:  errors.New("server unavailable"),
			Message: "Please try again later",
			Code:    servicehelper.UnexpectedError,
		}
	}
	return resDTO, nil
}
215911
func (q *Qbs) WhereEqual(column string, value interface{}) *Qbs {
	q.criteria.condition = NewEqualCondition(column, value)
	return q
}
783327
func (q Query) Where(predicate func(interface{}) bool) Query {
	return Query{
		Iterate: func() Iterator {
			next := q.Iterate()

			return func() (item interface{}, ok bool) {
				for item, ok = next(); ok; item, ok = next() {
					if predicate(item) {
						return
					}
				}

				return
			}
		},
	}
}
309027
func (b *DeleteBuilder) Where(w ...Cmp) *DeleteBuilder {
	b.where = append(b.where, w...)
	return b
}
1091607
func NewProjectWhere(description *Project) (project *Project, e error) {
	project = new(Project)
	if e = Db().Where(description).Scan(project); e != nil {
		return
	}
	return
}
517099
func NewUserWhere(description *User) (user *User, e error) {
	user = new(User)
	if e = Db().Where(description).Scan(user); e != nil {
		return
	}

	if e = Db().First(&user.Profile, user.ID()); e != nil {
		return
	}

	return
}
113829
func (s *SelectQuery) Where(e Expression) *SelectQuery {
	s.where = e
	return s
}
661014
func (f *RelationalModelDefinition) PKWhere() string {
	var pkwhere []string
	for _, pk := range f.PrimaryKeys {
		def := fmt.Sprintf("%s = ?", pk.DatabaseFieldName)
		pkwhere = append(pkwhere, def)
	}
	return strings.Join(pkwhere, " and ")
}
66001
func (statement *Statement) Where(query interface{}, args ...interface{}) *Statement {
	return statement.And(query, args...)
}
754167
func (s *IndicesRolloverService) AddCondition(name string, value interface{}) *IndicesRolloverService {
	s.conditions[name] = value
	return s
}
471981
func (us *unionStatementImpl) AndWhere(expression BoolExpression) UnionStatement {
	if us.where == nil {
		return us.Where(expression)
	}
	us.where = And(us.where, expression)
	return us
}
405064
func (query Query) OrWhere(condition ...c.Condition) Query {
	query.Condition = query.Condition.Or(c.And(condition...))
	return query
}
1223583
func NewWhereFilter(ctx *plan.Context, sql *rel.SqlSelect) *Where {
	s := &Where{
		TaskBase: NewTaskBase(ctx),
		filter:   sql.Where.Expr,
	}
	cols := sql.ColIndexes()
	s.Handler = whereFilter(s.filter, s, cols)
	return s
}
43716
func (session *Session) Where(query interface{}, args ...interface{}) *Session {
	session.statement.Where(query, args...)
	return session
}