EQ appends a "=" predicate.
(col string, arg any)
| 865 | |
| 866 | // EQ appends a "=" predicate. |
| 867 | func (p *Predicate) EQ(col string, arg any) *Predicate { |
| 868 | // A small optimization to avoid passing |
| 869 | // arguments when it can be avoided. |
| 870 | switch arg := arg.(type) { |
| 871 | case bool: |
| 872 | if arg { |
| 873 | return IsTrue(col) |
| 874 | } |
| 875 | return IsFalse(col) |
| 876 | default: |
| 877 | return p.Append(func(b *Builder) { |
| 878 | b.Ident(col) |
| 879 | b.WriteOp(OpEQ) |
| 880 | p.arg(b, arg) |
| 881 | }) |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | // ColumnsEQ appends a "=" predicate between 2 columns. |
| 886 | func ColumnsEQ(col1, col2 string) *Predicate { |