Class SQLSyntax

An class represents a SQL query piece / fragment. The provided sqls tagged template literals will output an instance of SQLSyntax class. All properties of SQLSyntax are readonly. Thus is immutable. An instance of SQLSyntax class will record

Constructors

  • Parameters

    • isEmpty: boolean
    • Optional rawSqlParts: TemplateStringsArray
    • Optional rawValues: RawValue[]
    • Optional sqlParts: string[]
    • Optional values: Value[]

    Returns SQLSyntax

Properties

isEmpty: boolean
rawSqlParts?: TemplateStringsArray
rawValues?: RawValue[]
sqlParts: string[] = []
values: Value[] = []
asc: SQLSyntax = ...
customToQueryFunc?: ((sql) => [string, Value[]])

Type declaration

desc: SQLSyntax = ...
empty: SQLSyntax = ...
isDebugMode: boolean = false

Methods

  • Allow create an instance of SQLSyntax from a string variable sqlStr. The content of the string variable sqlStr will become the SQL query string without any escaping. You might need this method to create indentifier (e.g. tbale or column names) as SQLSyntax. Make sure you process the string input well to avoid SQL injection vulnerability.

    Parameters

    • sqlStr: string

    Returns SQLSyntax

    Static

    Memberof

    SQLSyntax

Generated using TypeDoc