import type { DatabaseValues } from "./adapters/adapter.ts" ; export enum QueryOperator { In = "IN" , NotIn = "NOT IN" , Between = "BETWEEN" , NotBetween = "NOT BETWEEN" , Like = "LIKE" , NotLike = "NOT LIKE" , Ilike = "ILIKE" , NotIlike = "ILIKE" , Equal = "=" , NotEqual = "!=" , GreaterThan = ">" , GreaterThanEqual = ">=" , LowerThan = "<" , LowerThanEqual = "<=" , Null = "IS NULL" , NotNull = "IS NOT NULL" } /** Query expression builder */ export class Q { constructor ( public operator , public value ) { } /** The value is one of the given values */ public static in ( values ) { return new Q ( QueryOperator . In , values ) ; } /** The value is not one of the given values */ public static notIn ( values ) { return new Q ( QueryOperator . NotIn , values ) ; } /** The value (number) is between these numbers */ public static between ( value1 , value2 ) { return new Q ( QueryOperator . Between , [ value1 , value2 ] ) ; } /** The value (number) is between these numbers */ public static notBetween ( value1 , value2 ) { return new Q ( QueryOperator . NotBetween , [ value1 , value2 ] ) ; } /** LIKE operator */ public static like ( value ) { return new Q ( QueryOperator . Like , value ) ; } /** NOT LIKE operator */ public static notLike ( value ) { return new Q ( QueryOperator . NotLike , value ) ; } /** ILIKE (case-insensitive) operator */ public static ilike ( value ) { return new Q ( QueryOperator . Ilike , value ) ; } /** NOT ILIKE (case-insensitive) operator */ public static notIlike ( value ) { return new Q ( QueryOperator . NotIlike , value ) ; } /** Is equal to (=) */ public static eq ( value ) { return new Q ( QueryOperator . Equal , value ) ; } /** Is not equal to (!=) */ public static neq ( value ) { return new Q ( QueryOperator . NotEqual , value ) ; } /** Greater than (>) */ public static gt ( value ) { return new Q ( QueryOperator . GreaterThan , value ) ; } /** Greater than equal (>=) */ public static gte ( value ) { return new Q ( QueryOperator . GreaterThanEqual , value ) ; } /** Lower than (<) */ public static lt ( value ) { return new Q ( QueryOperator . LowerThan , value ) ; } /** Lower than equal (<=) */ public static lte ( value ) { return new Q ( QueryOperator . LowerThanEqual , value ) ; } /** The value is null */ public static null ( ) { return new Q ( QueryOperator . Null , null ) ; } /** The value is not null */ public static notNull ( ) { return new Q ( QueryOperator . NotNull , null ) ; } }