# Variable default

default: {
copyDatabase: (targetFilePath: string) => Promise<void>;
dbConnection: Database;
disableSlowQueryLogging: <T>(cb: () => T) => T;
execute: (query: string, params?: any) => RunResult;
executeMany: (query: string, params: any) => void;
executeScript: (query: string) => DatabaseType;
fillParamList: (
paramIds: string[] | Set<string>,
truncate?: boolean,
) => void;
getColumn: <T>(query: string, params?: any) => T[];
getManyRows: <T>(query: string, params: any) => T[];
getMap: <K extends string | number | symbol, V>(
query: string,
params?: any,
) => Record<K, V>;
getRawRows: <T extends {} | unknown[]>(query: string, params?: any) => T[];
getRow: <T>(query: string, params?: any) => T;
getRowOrNull: <T>(query: string, params?: any) => T | null;
getRows: <T>(query: string, params?: any) => T[];
getValue: <T>(query: string, params?: any) => T;
insert: <T extends {}>(
tableName: string,
rec: T,
replace?: boolean,
) => undefined | null | number | bigint;
iterateRows: <T>(query: string, params?: any) => IterableIterator<T>;
rebuildIntegrationTestDatabase: () => void;
replace: <T extends {}>(tableName: string, rec: T) => number | null;
transactional: <T>(
func: (statement: Statement<unknown[], unknown>) => T,
) => any;
upsert: <T extends {}>(
tableName: string,
primaryKey: string,
rec: T,
) => void;
}

#### Type declaration

- ##### copyDatabase: (targetFilePath: string) => Promise<void>

- ##### dbConnection: Database

- ##### disableSlowQueryLogging: <T>(cb: () => T) => T

- ##### execute: (query: string, params?: any) => RunResult

  Execute SQL

- ##### executeMany: (query: string, params: any) => void

- ##### executeScript: (query: string) => DatabaseType

- ##### fillParamList: (paramIds: string[] | Set<string>, truncate?: boolean) => void

- ##### getColumn: <T>(query: string, params?: any) => T[]

  Get a first column in an array.

- ##### getManyRows: <T>(query: string, params: any) => T[]

- ##### getMap: <K extends string | number | symbol, V>(
  query: string,
  params?: any,
  ) => Record<K, V>

  Get a map of first column mapping to second column.

- ##### getRawRows: <T extends {} | unknown[]>(query: string, params?: any) => T[]

- ##### getRow: <T>(query: string, params?: any) => T

  Get first returned row.

- ##### getRowOrNull: <T>(query: string, params?: any) => T | null

- ##### getRows: <T>(query: string, params?: any) => T[]

  Get all returned rows.

- ##### getValue: <T>(query: string, params?: any) => T

  Get single value from the given query - first column from first returned row.

- ##### insert: <T extends {}>(
  tableName: string,
  rec: T,
  replace?: boolean,
  ) => undefined | null | number | bigint

- ##### iterateRows: <T>(query: string, params?: any) => IterableIterator<T>

- ##### rebuildIntegrationTestDatabase: () => void

- ##### replace: <T extends {}>(tableName: string, rec: T) => number | null

- ##### transactional: <T>(func: (statement: Statement<unknown[], unknown>) => T) => any

- ##### upsert: <T extends {}>(tableName: string, primaryKey: string, rec: T) => void

- Defined in services/sql.ts:342