Utility class to build sql queries

Hierarchy

  • SqliteQueryBuilder

Constructors

Methods

  • Builds a count statement

    Returns

    count statement

    Parameters

    • tables: string

      table names to query for

    • Optional where: string

      where clause

    Returns string

  • Builds an insert statement using the properties of the object

    Returns

    insert statement

    Parameters

    • table: string

      table to insert into

    • object: any

      object to insert

    Returns string

  • Builds an insert statement from the object.getColumnNames method

    Returns

    insert statement

    Parameters

    • table: string

      table to insert into

    • object: any

      object with a getColumnNames method

    Returns string

  • Builds an update from an object

    Returns

    update statement

    Parameters

    • table: string

      table name to update

    • object: any

      object with values to update

    Returns string

  • Builds a query

    Returns

    Parameters

    • distinct: boolean

      whether query should be distinct or not

    • tables: string

      table names to query, added to the query from clause

    • Optional columns: string[]

      columns to query for

    • Optional where: string

      where clause

    • Optional join: string

      join clause

    • Optional groupBy: string

      group by clause

    • Optional having: string

      having clause

    • Optional orderBy: string

      order by clause

    • Optional limit: number

      limit

    • Optional offset: number

      offset

    Returns string

  • Builds an update statement

    Returns

    object with a sql property containing the update statement and an args property with bind arguments

    Parameters

    • table: string

      table to update

    • values: Record<string, DBValue>

      object with values to update

    • Optional where: string

      where clause

    • Optional whereArgs: DBValue | DBValue[]

      where bind parameters

    Returns {
        args: DBValue[];
        sql: string;
    }

  • Builds an update or insert object to bind to a statement

    Returns

    bind parameters

    Parameters

    • object: any

      object to create bind parameters from

    Returns any

  • Replaces all whitespace in a column name with underscores

    Returns

    Parameters

    • columnName: string

      column name to fix

    Returns string

Generated using TypeDoc