Options
All
  • Public
  • Public/Protected
  • All
Menu
description

Module to export all public Unified Storage APIs for db-agnostic schemaless storage of objects.

Index

Type aliases

AggregateProperties

AggregateProperties: string | string[]

Defines the format of nested properties used for aggregating objects. Both dot notation ("property.subproperty.subsubproperty") and array notation (["property", "subproperty", "subsubproperty"]) are supported for naming nested properties. Note that dot notation cannot be used if one of the properties contains a dot (.) in its name. In such cases, array notation must be used.

DbAdapterExtension

DbAdapterExtension: (...args: any) => Promise<any>

Type declaration

    • (...args: any): Promise<any>
    • Parameters

      • Rest ...args: any

      Returns Promise<any>

IDbAdapterConstructor

IDbAdapterConstructor: new (connectionInfo: DbConnectionInfo) => IDbAdapter & IDbAdapterExtension

Type declaration

SqlQueryBuilder

SqlQueryBuilder: (placeholder: string, appendIndex: boolean, startIndex: number, asIdentifier: (id: string) => string, asLiteral: (literal: string) => string, embedParams?: boolean) => [string, any[]]

Type declaration

    • (placeholder: string, appendIndex: boolean, startIndex: number, asIdentifier: (id: string) => string, asLiteral: (literal: string) => string, embedParams?: boolean): [string, any[]]
    • A universal SQL query builder function to be called by a specific database adapter to yield a database specific SQL query tuple, consisting of a parameterized SQL query text and an array of bound parameter values.

      The DB API provides two predefined functions that create and return SQL query builder functions: SQL and RAW.

      Parameters

      • placeholder: string
      • appendIndex: boolean
      • startIndex: number
      • asIdentifier: (id: string) => string
          • (id: string): string
          • Parameters

            • id: string

            Returns string

      • asLiteral: (literal: string) => string
          • (literal: string): string
          • Parameters

            • literal: string

            Returns string

      • Optional embedParams: boolean

      Returns [string, any[]]

Functions

RAW

  • Use this function to build a query from raw text and the given bound parameters. Raw text has SQL placeholders already in place. No substitutions take place; the text is passed to the database as is.

    Use of the SQL tag function is preferred over RAW, because RAW SQL text is database specific due to the non-uniform parameter placeholder conventions of different SQL dialects.

    Parameters

    • text: string

      the raw query text with SQL parameter placeholders applied

    • Rest ...params: any[]

      the bound parameters supplied to the query

    Returns SqlQueryBuilder

SQL

  • Tag function for defining universal SQL queries by template literals.

    Template placeholder ${...} are treated as bound parameters supplied to the query and are substituted by the appropriate SQL parameter placeholder (e.g. $1, $2, etc. in Postgres, ? in mySQL, SQLite).

    Template placeholders can be annotated: Use ${...}{IDENT} or ${...}{LIT} to escape the values and insert them as SQL identifiers or literals in the query text. Note that annotated placeholders are not treated as bound parameters of the query.

    You can also use the SQL tag within a template placeholder to (recursively) insert another SQL query into the current one. This is useful if you want to conditionally insert or append subqueries.

    Example query:

    SQL`SELECT * FROM ${myTable}{IDENT} WHERE name = ${myName};`
    

    Parameters

    • parts: TemplateStringsArray

      the text parts between the placeholders

    • Rest ...values: any[]

      the evaluated expressions of all template placeholders.

    Returns SqlQueryBuilder

Generated using TypeDoc