github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/go-xorm/builder/cond_null.go (about) 1 package builder 2 3 import "fmt" 4 5 // IsNull 6 type IsNull [1]string 7 8 var _ Cond = IsNull{""} 9 10 func (isNull IsNull) WriteTo(w Writer) error { 11 _, err := fmt.Fprintf(w, "%s IS NULL", isNull[0]) 12 return err 13 } 14 15 func (isNull IsNull) And(conds ...Cond) Cond { 16 return And(isNull, And(conds...)) 17 } 18 19 func (isNull IsNull) Or(conds ...Cond) Cond { 20 return Or(isNull, Or(conds...)) 21 } 22 23 func (isNull IsNull) IsValid() bool { 24 return len(isNull[0]) > 0 25 } 26 27 // NotNull 28 type NotNull [1]string 29 30 var _ Cond = NotNull{""} 31 32 func (notNull NotNull) WriteTo(w Writer) error { 33 _, err := fmt.Fprintf(w, "%s IS NOT NULL", notNull[0]) 34 return err 35 } 36 37 func (notNull NotNull) And(conds ...Cond) Cond { 38 return And(notNull, And(conds...)) 39 } 40 41 func (notNull NotNull) Or(conds ...Cond) Cond { 42 return Or(notNull, Or(conds...)) 43 } 44 45 func (notNull NotNull) IsValid() bool { 46 return len(notNull[0]) > 0 47 }