Class GeoPackageDao<T, ID>Abstract

Abstract GeoPackage DAO

Type Parameters

  • T

    The class that the code will be operating on.

  • ID

Hierarchy

Constructors

Properties

Database connection to the sqlite file

geoPackage: GeoPackage

GeoPackage

gpkgTableName: string

Name of the table within the GeoPackage

idColumns: string[]

ID Columns for this DAO

Methods

  • Get the primary key where clause

    Returns

    primary key where clause

    Parameters

    • idValue: any

      id

    Returns string

  • Build where or selection statement for fields

    Returns

    where clause

    Parameters

    • fields: FieldValues

      columns and values

    • Optional operation: string = 'and'

      AND or OR

    Returns string

  • Build where (or selection) LIKE statement for fields

    Returns

    where clause

    Parameters

    • fields: FieldValues

      columns and values

    • Optional operation: string

      AND or OR

    Returns string

  • Builds a where clause from the field and value with an optional operation. If the value is empty, 'is null' is added to the query for the field

    Returns

    where clause

    Parameters

    • field: string

      field name

    • Optional value: DBValue

      optional value to filter on

    • Optional operation: string = '='

      optional operation

    Returns string

  • Count rows in the table optionally filtered by the parameters specified

    Returns

    count of objects

    Parameters

    • Optional fields: string | FieldValues

      Either a ColumnValues object or a string specifying a field name

    • Optional value: DBValue

      value to filter on if fields is a string

    Returns number

  • Count all matching objects

    Returns

    Parameters

    • join: string

      join clause

    • Optional where: string

      where clause

    • Optional whereArgs: DBValue[]

      array of where query values

    Returns number

  • Count rows in the table optionally filtered by the parameters specified

    Returns

    count of objects

    Parameters

    • where: string

      where string

    • whereArgs: DBValue[]

      arguments to filter on

    Returns number

  • Insert the object into the table

    Returns

    id of the inserted object

    Parameters

    • object: T

      object to be inserted

    Returns number

  • Delete the object passed in. Object is deleted by id

    Returns

    number of objects deleted

    Parameters

    • object: Record<string, DBValue> | T

      object to delete

    Returns number

  • Delete all objects in the table

    Returns

    number of objects deleted

    Returns number

  • Delete the object specified by the ids

    Returns

    number of objects deleted

    Parameters

    • idValues: any[]

      id values

    Returns number

  • Delete objects that match the query

    Returns

    number of objects deleted

    Parameters

    • where: string

      where clause

    • whereArgs: DBValue[]

      where arguments

    Returns number

  • Checks if the ID exists

    Parameters

    • id: ID

    Returns boolean

  • Check if the DAO is backed by a table

    Returns

    true if a table exists

    Returns boolean

  • Check if the DAO is backed by a table or a view

    Returns

    true if a table or view exists

    Returns boolean

  • Check if the DAO is backed by a view

    Returns

    true if a view exists

    Returns boolean

  • Get the max of the column

    Returns

    Parameters

    • column: string

      column name

    • Optional where: string

      where clause

    • Optional whereArgs: DBValue[]

      where args

    Returns number

  • Get the min of the column

    Returns

    Parameters

    • column: string

      column name

    • Optional where: string

      where clause

    • Optional whereArgs: DBValue[]

      where args

    Returns number

  • Performs a raw query

    Parameters

    • sql: string
    • Optional params: [] | Record<string, any>

    Returns Record<string, DBValue>[]

  • Performs a raw query

    Parameters

    • sql: string
    • Optional params: [] | Record<string, any>

    Returns IterableIterator<any>

  • Queries for all matches and returns them in the callback. Be aware this pulls all results into memory

    Returns

    raw object array from the database

    Parameters

    • Optional where: string

      Optional where clause

    • Optional whereArgs: DBValue[]

      Optional where args array

    Returns Record<string, DBValue>[]

  • Queries for all matches and returns them in the callback. Be aware this pulls all results into memory

    Returns

    raw object array from the database

    Parameters

    • Optional where: string

      Optional where clause

    • Optional whereArgs: DBValue[]

      Optional where args array

    Returns T[]

  • Query for all rows in the table that match

    Returns

    array of raw database objects

    Parameters

    • field: string

      field to match

    • value: DBValue

      value to match

    • Optional groupBy: string

      group by clause

    • Optional having: string

      having clause

    • Optional orderBy: string

      order by clause

    Returns Record<string, DBValue>[]

  • Queries for all items in the table with a page size and page number

    Returns

    raw object array from the database

    Parameters

    • pageSize: number

      size of the chunk to query for

    • page: number

      chunk number to query for

    Returns Record<string, DBValue>[]

  • Query for column of rows matching the where clause

    Parameters

    • columnName: string
    • Optional where: string
    • Optional whereArgs: DBValue[]

    Returns Record<string, DBValue>[]

  • Queries for all matches and returns them. Only queries for the specified column name Be aware this pulls all results into memory

    Returns

    raw object array from the database

    Parameters

    • columnName: string

      name of the column to query for

    • Optional fieldValues: FieldValues

      optional values to filter on

    Returns Record<string, DBValue>[]

  • Iterate all items in the table one at a time. If no parameters are passed, iterates the entire table. Returns an Iterable object

    Returns

    iterable of database objects

    Parameters

    • Optional field: string

      field to filter on

    • Optional value: DBValue

      value to filter on

    • Optional groupBy: string

      group by clause

    • Optional having: string

      having clause

    • Optional orderBy: string

      order by clause

    • Optional columns: string[]

      columns to retrieve

    Returns IterableIterator<Record<string, DBValue>>

  • Query for equal

    Parameters

    • field: string
    • value: any

    Returns T[]

  • Queries for all matches and returns them in the callback. Be aware this pulls all results into memory

    Returns

    raw object array from the database

    Parameters

    • fieldName: string

      name of the field to query for

    • value: string

      value of the like clause

    Returns Record<string, DBValue>[]

  • Query for object by multi id

    Returns

    object created from the raw database object

    Parameters

    • idValues: DBValue[]

      ColumnValues with the multi id

    Returns T

  • Iterate all matching objects

    Returns

    Parameters

    • join: string

      join clause

    • Optional where: string

      where clause

    • Optional whereArgs: DBValue[]

      array of where query values

    • Optional columns: string[]

      columns to query for

    Returns IterableIterator<Record<string, DBValue>>

  • Performs a raw query

    Parameters

    • sql: string
    • Optional params: [] | Record<string, any>

    Returns Record<string, DBValue>

  • Iterate all matching rows

    Returns

    Parameters

    • Optional where: string

      where clause

    • Optional whereArgs: DBValue[]

      array of where query values

    • Optional groupBy: string

      group by clause

    • Optional having: string

      having clause

    • Optional orderBy: string

      order by clause

    • Optional limit: number

      limit clause

    Returns IterableIterator<Record<string, DBValue>>

  • Iterate all distinct matching rows in the table

    Returns

    Parameters

    • where: string

      where clause

    • Optional whereArgs: DBValue[]

      array of where query values

    Returns IterableIterator<Record<string, DBValue>>

  • Refreshes the object by id

    Parameters

    • object: T

      object to refresh

    Returns T

  • Rename the table

    Parameters

    • newName: string

    Returns void

  • Check if the table exists

    Returns

    true if exists

    Parameters

    • tableName: string

      table name

    Returns boolean

  • Check if a table or view exists with the name

    Returns

    true if exists

    Parameters

    • name: string

      table or view name

    Returns boolean

  • Update the object specified

    Returns

    number of objects updated

    Parameters

    • object: T

      object with updated values

    Returns {
        changes: number;
        lastInsertRowid: number;
    }

    • changes: number
    • lastInsertRowid: number
  • Update all rows that match the query

    Returns

    number of objects updated

    Parameters

    • values: Record<string, DBValue>

      values to insert

    • where: string

      where clause

    • whereArgs: DBValue[]

      where arguments

    Returns {
        changes: number;
        lastInsertRowid: number;
    }

    • changes: number
    • lastInsertRowid: number
  • Check if the view exists

    Returns

    true if exists

    Parameters

    • viewName: string

      view name

    Returns boolean

Generated using TypeDoc