(defn make-alias
[&opt prefix]
(def prefix (cond
(nil? prefix) ""
(not (bytes? prefix)) ""
(> (length prefix) 7) (string/slice prefix 0 7)
prefix))
(string prefix (gensym)))
(def operators
{'= "%s = %s"
'not= "%s <> %s"
'+ "%s + %s"
'- "%s - %s"
'* "%s * %s"
'/ "%s / %s"
'mod "%s % %s"
'= "%s = %s"
'not= "%s <> %s"
'> "%s > %s"
'< "%s < %s"
'>= "%s >= %s"
'<= "%s <= %s"
'between "%s BETWEEN %s AND %s"
'in "%s IN %s"
'not-in "%s NOT IN %s"
'exists "EXISTS %s"
'nil? "%s IS NULL"
'and "(%s AND %s)"
'or "(%s OR %s)"
'not "NOT %s"
'like "%s LIKE %s"
'glob "%s GLOB %s"
# TODO: Make this variadic.
'string "%s || %s"
'unique "UNIQUE %s"})