github.com/kunlun-qilian/sqlx/v3@v3.0.0/builder/addition_where.go (about) 1 package builder 2 3 import ( 4 "context" 5 ) 6 7 type WhereAddition struct{} 8 9 func (WhereAddition) AdditionType() AdditionType { 10 return AdditionWhere 11 } 12 13 func Where(c SqlCondition) *where { 14 return &where{ 15 condition: c, 16 } 17 } 18 19 var _ Addition = (*where)(nil) 20 21 type where struct { 22 WhereAddition 23 condition SqlCondition 24 } 25 26 func (w *where) IsNil() bool { 27 return w == nil || IsNilExpr(w.condition) 28 } 29 30 func (w *where) Ex(ctx context.Context) *Ex { 31 e := Expr("WHERE ") 32 e.WriteExpr(w.condition) 33 return e.Ex(ctx) 34 }