Interface DataSourceDriver

Represents a driver to connect to a data source, for example a database (MYSQL, Mongo, etc)

Hierarchy

  • DataSourceDriver

Methods

  • Inserts many rows

    Parameters

    • table: string

      Table or collection name

    • rows: any[]

      List of rows to insert

    Returns Promise<void>

  • Deletes a row

    Returns

    true if the row was deleted, false if the row didn't exists

    Parameters

    • table: string

      Table or collection name

    • keyName: string

      Name of the key

    • keyValue: any

      Value of the key

    Returns Promise<boolean>

  • Deletes many rows

    Returns

    The number of affected rows

    Parameters

    • table: string

      Table or collection name

    • filter: GenericFilter

      Filter to apply

    Returns Promise<number>

  • Finds rows

    Parameters

    • table: string

      Table or collection name

    • filter: GenericFilter

      Filter to apply

    • sortBy: string

      Sort results by this field. Leave as null for default sorting

    • sortDir: SortDirection

      "asc" or "desc". Leave as null for default sorting

    • skip: number

      Number of rows to skip. Leave as -1 for no skip

    • limit: number

      Limit of results. Leave as -1 for no limit

    • projection: Set<string>

      List of fields to fetch from the table. Leave as null to fetch them all.

    • queryExtraOptions: QueryExtraOptions

      Additional query options

    Returns Promise<any[]>

  • Finds a row by primary key

    Parameters

    • table: string

      Table or collection name

    • keyName: string

      Name of the key

    • keyValue: any

      Value of the key

    Returns Promise<any>

  • Finds rows (stream mode). You can parse each row with an ASYNC function

    Parameters

    • table: string

      Table or collection name

    • filter: GenericFilter

      Filter to apply

    • sortBy: string

      Sort results by this field. Leave as null for default sorting

    • sortDir: SortDirection

      "asc" or "desc". Leave as null for default sorting

    • skip: number

      Number of rows to skip. Leave as -1 for no skip

    • limit: number

      Limit of results. Leave as -1 for no limit

    • projection: Set<string>

      List of fields to fetch from the table. Leave as null to fetch them all.

    • queryExtraOptions: QueryExtraOptions

      Additional query options

    • each: ((row: any) => Promise<void>)

      Function to parse each row

        • (row: any): Promise<void>
        • Parameters

          • row: any

          Returns Promise<void>

    Returns Promise<void>

  • Finds rows (stream mode). You can parse each row with a SYNC function

    Parameters

    • table: string

      Table or collection name

    • filter: GenericFilter

      Filter to apply

    • sortBy: string

      Sort results by this field. Leave as null for default sorting

    • sortDir: SortDirection

      "asc" or "desc". Leave as null for default sorting

    • skip: number

      Number of rows to skip. Leave as -1 for no skip

    • limit: number

      Limit of results. Leave as -1 for no limit

    • projection: Set<string>

      List of fields to fetch from the table. Leave as null to fetch them all.

    • queryExtraOptions: QueryExtraOptions

      Additional query options

    • each: ((row: any) => void)

      Function to parse each row

        • (row: any): void
        • Parameters

          • row: any

          Returns void

    Returns Promise<void>

  • Atomic increment

    Parameters

    • table: string

      Table or collection name

    • keyName: string

      The name of the key

    • keyValue: any

      The value of the key

    • prop: string

      The field to increment

    • inc: number

      The amount to increment

    Returns Promise<void>

  • Inserts a row

    Parameters

    • table: string

      Table or collection name

    • row: any

      Row to insert

    • key: string

      The name of the primary key (if any)

    • Optional callback: ((value: any) => void)

      Callback to set the value of the primary key after inserting (Optional, only if auto-generated key)

        • (value: any): void
        • Parameters

          • value: any

          Returns void

    Returns Promise<void>

  • Summation of many rows

    Parameters

    • table: string

      Table or collection name

    • filter: GenericFilter

      Filter to apply

    • id: string

      Name of the primary key

    • field: string

      Name of the field to aggregate

    Returns Promise<number>

  • Updates a row

    Parameters

    • table: string

      Table or collection name

    • keyName: string

      Name of the key

    • keyValue: any

      Value of the key

    • updated: any

      Updated row

    Returns Promise<void>

Generated using TypeDoc