Interface BaseQueryBuilder

BaseQueryBuilder provides a basic implementation of QueryBuilder.

Hierarchy

  • BaseQueryBuilder

Methods

  • BuildFrom generates a FROM clause from the given tables.

    Parameters

    • tables: string[]

    Returns string

  • BuildGroupBy generates a GROUP BY clause from the given group-by columns.

    Parameters

    • cols: string[]

    Returns string

  • BuildHaving generates a HAVING clause from the given expression.

    Parameters

    Returns string

  • BuildJoin generates a JOIN clause from the given join information.

    Parameters

    Returns string

  • BuildLimit generates the LIMIT clause.

    Parameters

    • limit: number
    • offset: number

    Returns string

  • BuildOrderBy generates the ORDER BY clause.

    Parameters

    • cols: string[]

    Returns string

  • BuildOrderByAndLimit generates the ORDER BY and LIMIT clauses.

    Parameters

    • sql: string
    • cols: string[]
    • limit: number
    • offset: number

    Returns string

  • BuildSelect generates a SELECT clause from the given selected column names.

    Parameters

    • cols: string[]
    • distinct: boolean
    • option: string

    Returns string

  • BuildUnion generates a UNION clause from the given union information.

    Parameters

    Returns string

  • BuildWhere generates a WHERE clause from the given expression.

    Parameters

    Returns string

  • CombineUnion combines the nonempty unionClause with the provided sql string.

    The unionClause is expected to be the result of BuildUnion. If the unionClause is an empty string it returns the sql argument unmodified.

    This method exists as a workaround to minimize breaking changes and to allow different SQL builders to specify for example whether they support parenthesis around the UNION SQL queries (SQLite for example will throw a SyntaxError if the UNION parts are wrapped in parenthesis).

    Parameters

    • sql: string
    • unionClause: string

    Returns string

Generated using TypeDoc