func NotSimilarTo(col SchemaField, value string) Condition {
	return func(schema Schema) ToSqler {
		return &colOp{col.QualifiedName(schema), "NOT SIMILAR TO", value}
	}
}
NotSimilarTo returns a condition that will be true when `col` does not match
the given `value`.
See https://www.postgresql.org/docs/9.6/static/functions-matching.html.
package kallax
import (
	"database/sql/driver"
	"errors"
	"fmt"
	"strings"
	"gopkg.in/src-d/go-kallax.v1/types"
	"github.com/Masterminds/squirrel"
)
type ScalarCond func(col SchemaField, value interface{}) Condition
type ToSqler interface {
	squirrel.Sqlizer
}
func NewOperator(format string) func(SchemaField, interface{}) Condition {
	return func(col SchemaField, value interface{}) Condition {
		return func(schema Schema) ToSqler {
			return newCustomOp(format, col.QualifiedName(schema), []interface{}{value}, false)
		}
	}
}
func NewMultiOperator(format string) func(SchemaField, ...interface{}) Condition {
	return func(col SchemaField, values ...interface{}) Condition {
		return func(schema Schema) ToSqler {
			return newCustomOp(format, col.QualifiedName(schema), values, true)
		}
	}
}
type customOp struct {
	sql  string
	args []interface{}
}
func newCustomOp(format, col string, values []interface{}, multi bool) *customOp {
	var args string
	if len(values) == 1 && !multi {
		args = "?"
	} else {
		var elems = make([]string, len(values))
		for i := range values {
			elems[i] = "?"
		}
		args = fmt.Sprintf("(%s)", strings.Join(elems, ", "))
	}
	return &customOp{
		strings.Replace(
			strings.Replace(format, ":col:", col, -1),
			":arg:", args, -1,
		),
		values,
	}
}
func (op *customOp) ToSql() (string, []interface{}, error) {
	return op.sql, op.args, nil
}
type Condition func(Schema) ToSqler
func Eq(col SchemaField, value interface{}) Condition {
	return func(schema Schema) ToSqler {
		return squirrel.Eq{col.QualifiedName(schema): value}
	}
}
func Lt(col SchemaField, value interface{}) Condition {
	return func(schema Schema) ToSqler {
		return squirrel.Lt{col.QualifiedName(schema): value}
	}
}
func Gt(col SchemaField, value interface{}) Condition {
	return func(schema Schema) ToSqler {
		return squirrel.Gt{col.QualifiedName(schema): value}
	}
}
func LtOrEq(col SchemaField, value interface{}) Condition {
	return func(schema Schema) ToSqler {
		return squirrel.LtOrEq{col.QualifiedName(schema): value}
	}
}
func GtOrEq(col SchemaField, value interface{}) Condition {
	return func(schema Schema) ToSqler {
		return squirrel.GtOrEq{col.QualifiedName(schema): value}
	}
}
func Neq(col SchemaField, value interface{}) Condition {
	return func(schema Schema) ToSqler {
		return squirrel.NotEq{col.QualifiedName(schema): value}
	}
}
func Like(col SchemaField, value string) Condition {
	return func(schema Schema) ToSqler {
		return &colOp{col.QualifiedName(schema), "LIKE", value}
	}
}
func Ilike(col SchemaField, value string) Condition {
	return func(schema Schema) ToSqler {
		return &colOp{col.QualifiedName(schema), "ILIKE", value}
	}
}
func SimilarTo(col SchemaField, value string) Condition {
	return func(schema Schema) ToSqler {
		return &colOp{col.QualifiedName(schema), "SIMILAR TO", value}
	}
}