# Type Alias DbExportsType

type DbExportsType = {
add_fts_index: (
table: string,
column: string,
language?: string,
disable_fts?: boolean,
) => Promise<void>;
add_index: (table: string, columns: string[]) => Promise<void>;
add_unique_constraint: (
table: string | undefined,
columns: string[],
) => Promise<void>;
begin: () => Promise<void>;
changeConnection: (connectObj: any) => void;
close: () => Promise<void>;
commit: () => Promise<void>;
commitAndBeginNewTransaction: () => Promise<void>;
connectObj: GenObj;
copyFrom: (
readStream: ReadStream,
table: string,
fieldNames: any[],
client: any,
) => Promise<any>;
copyToJson?: (
writeStream: WriteStream,
table: string,
opts?: any,
) => Promise<void>;
count: (
table: string,
where?: Where,
opts?: SelectOptions,
) => Promise<number>;
delete: (table: string, where: Where) => Promise<any>;
deleteWhere: (table: string, where: Where) => Promise<any>;
drop_fts_index: (table: string) => Promise<void>;
drop_index: (table: string, columns: string[]) => Promise<void>;
drop_reset_schema: () => Promise<void>;
drop_unique_constraint: (
table: string | undefined,
columns: string[],
) => Promise<void>;
dropTable: (table: string) => Promise<any>;
dropTables: (tables: string[]) => Promise<any>;
enable_multi_tenant: () => void;
get_db_filepath: () => string;
get_sql_logging: () => boolean;
getClient: () => Promise<any>;
getRequestContext: () => {
client?: object
| string;
req: { __: (str: string) => string; getLocale: () => string };
};
getTenantSchema: () => string;
getTenantSchemaPrefix: () => string;
getVersion: (arg?: boolean) => Promise<string>;
insert: (table: string, data: GenObj, opts?: any) => Promise<any>;
is_it_multi_tenant: () => boolean;
is_node: boolean;
is_sqlite: boolean;
isSQLite: boolean;
listScTables: () => Promise<any>;
listTables: () => Promise<any>;
listUserDefinedTables: () => Promise<any>;
mkWhere: (q: Where) => any;
query: (sql: string, params?: any) => Promise<any>;
reset: () => Promise<void>;
reset_sequence: (table: string, column?: string) => Promise<void>;
rollback: () => Promise<void>;
runWithTenant: (tenantId: string | RequestContext, fn: any) => Promise<any>;
select: (
table: string,
where?: Where | string,
opts?: SelectOptions,
) => Promise<any>;
selectMaybeOne: (table: string, where: Where, opts?: any) => Promise<any>;
selectOne: (
table: string,
where: Where,
opts?: SelectOptions,
) => Promise<any>;
set_sql_logging: (enabled: boolean) => void;
setConnectionObject: (connectObj: any) => void;
slugify: (str: string) => string;
sqlsanitize: (s?: string) => string;
tenant: typeof multi-tenant;
time: () => Promise<Date>;
truncate: (table: string) => Promise<void>;
tryCatchInTransaction: <T>(
fn: () => Promise<T>,
onError?: (err: Error) => Promise<T | void> | T | void,
) => Promise<T>;
update: (
table: string,
data: Row,
id: PrimaryKeyValue | Row | undefined,
opts?: any,
) => Promise<any>;
updateWhere: (table: string, data: Row, where: Where) => Promise<any>;
withTransaction: (
fn: () => Promise<any>,
onError?: (e: Error) => Promise<void>,
) => Promise<any>;
[key: string]: any;
}

#### Indexable

- [key: string]: any

- Defined in types.ts:11

##### Index

### Properties

add_fts_index
add_index
add_unique_constraint
begin
changeConnection
close
commit
commitAndBeginNewTransaction
connectObj
copyFrom
copyToJson?
count
delete
deleteWhere
drop_fts_index
drop_index
drop_reset_schema
drop_unique_constraint
dropTable
dropTables
enable_multi_tenant
get_db_filepath
get_sql_logging
getClient
getRequestContext
getTenantSchema
getTenantSchemaPrefix
getVersion
insert
is_it_multi_tenant
is_node
is_sqlite
isSQLite
listScTables
listTables
listUserDefinedTables
mkWhere
query
reset
reset_sequence
rollback
runWithTenant
select
selectMaybeOne
selectOne
set_sql_logging
setConnectionObject
slugify
sqlsanitize
tenant
time
truncate
tryCatchInTransaction
update
updateWhere
withTransaction

## Properties

### add_fts_index

add_fts_index: (
table: string,
column: string,
language?: string,
disable_fts?: boolean,
) => Promise<void>

- Defined in types.ts:64

### add_index

add_index: (table: string, columns: string[]) => Promise<void>

- Defined in types.ts:70

### add_unique_constraint

add_unique_constraint: (
table: string | undefined,
columns: string[],
) => Promise<void>

- Defined in types.ts:55

### begin

begin: () => Promise<void>

- Defined in types.ts:115

### changeConnection

changeConnection: (connectObj: any) => void

- Defined in types.ts:114

### close

close: () => Promise<void>

- Defined in types.ts:80

### commit

commit: () => Promise<void>

- Defined in types.ts:116

### commitAndBeginNewTransaction

commitAndBeginNewTransaction: () => Promise<void>

- Defined in types.ts:37

### connectObj

connectObj: GenObj

- Defined in types.ts:14

### copyFrom

copyFrom: (
readStream: ReadStream,
table: string,
fieldNames: any[],
client: any,
) => Promise<any>

- Defined in types.ts:91

### `Optional` copyToJson

copyToJson?: (
writeStream: WriteStream,
table: string,
opts?: any,
) => Promise<void>

- Defined in types.ts:84

### count

count: (table: string, where?: Where, opts?: SelectOptions) => Promise<number>

- Defined in types.ts:44

### delete

delete: (table: string, where: Where) => Promise<any>

- Defined in types.ts:26

### deleteWhere

deleteWhere: (table: string, where: Where) => Promise<any>

- Defined in types.ts:49

### drop_fts_index

drop_fts_index: (table: string) => Promise<void>

- Defined in types.ts:78

### drop_index

drop_index: (table: string, columns: string[]) => Promise<void>

- Defined in types.ts:79

### drop_reset_schema

drop_reset_schema: () => Promise<void>

- Defined in types.ts:106

### drop_unique_constraint

drop_unique_constraint: (
table: string | undefined,
columns: string[],
) => Promise<void>

- Defined in types.ts:59

### dropTable

dropTable: (table: string) => Promise<any>

- Defined in types.ts:110

### dropTables

dropTables: (tables: string[]) => Promise<any>

- Defined in types.ts:111

### enable_multi_tenant

enable_multi_tenant: () => void

- Defined in types.ts:120

### get_db_filepath

get_db_filepath: () => string

- Defined in types.ts:112

### get_sql_logging

get_sql_logging: () => boolean

- Defined in types.ts:118

### getClient

getClient: () => Promise<any>

- Defined in types.ts:89

### getRequestContext

getRequestContext: () => {
client?: object
| string;
req: { __: (str: string) => string; getLocale: () => string };
}

- Defined in types.ts:71

### getTenantSchema

getTenantSchema: () => string

- Defined in types.ts:63

### getTenantSchemaPrefix

getTenantSchemaPrefix: () => string

- Defined in types.ts:18

### getVersion

getVersion: (arg?: boolean) => Promise<string>

- Defined in types.ts:119

### insert

insert: (table: string, data: GenObj, opts?: any) => Promise<any>

- Defined in types.ts:19

### is_it_multi_tenant

is_it_multi_tenant: () => boolean

- Defined in types.ts:98

### is_node

is_node: boolean

- Defined in types.ts:16

### is_sqlite

is_sqlite: boolean

- Defined in types.ts:90

### isSQLite

isSQLite: boolean

- Defined in types.ts:15

### listScTables

listScTables: () => Promise<any>

- Defined in types.ts:109

### listTables

listTables: () => Promise<any>

- Defined in types.ts:107

### listUserDefinedTables

listUserDefinedTables: () => Promise<any>

- Defined in types.ts:108

### mkWhere

mkWhere: (q: Where) => any

- Defined in types.ts:17

### query

query: (sql: string, params?: any) => Promise<any>

- Defined in types.ts:39

### reset

reset: () => Promise<void>

- Defined in types.ts:32

### reset_sequence

reset_sequence: (table: string, column?: string) => Promise<void>

- Defined in types.ts:82

### rollback

rollback: () => Promise<void>

- Defined in types.ts:117

### runWithTenant

runWithTenant: (tenantId: string | RequestContext, fn: any) => Promise<any>

- Defined in types.ts:101

### select

select: (
table: string,
where?: Where | string,
opts?: SelectOptions,
) => Promise<any>

- Defined in types.ts:27

### selectMaybeOne

selectMaybeOne: (table: string, where: Where, opts?: any) => Promise<any>

- Defined in types.ts:38

### selectOne

selectOne: (table: string, where: Where, opts?: SelectOptions) => Promise<any>

- Defined in types.ts:50

### set_sql_logging

set_sql_logging: (enabled: boolean) => void

- Defined in types.ts:97

### setConnectionObject

setConnectionObject: (connectObj: any) => void

- Defined in types.ts:113

### slugify

slugify: (str: string) => string

- Defined in types.ts:100

### sqlsanitize

sqlsanitize: (s?: string) => string

- Defined in types.ts:13

### tenant

tenant: typeof multi-tenant

- Defined in types.ts:12

### time

time: () => Promise<Date>

- Defined in types.ts:83

### truncate

truncate: (table: string) => Promise<void>

- Defined in types.ts:81

### tryCatchInTransaction

tryCatchInTransaction: <T>(
fn: () => Promise<T>,
onError?: (err: Error) => Promise<T | void> | T | void,
) => Promise<T>

- Defined in types.ts:33

### update

update: (
table: string,
data: Row,
id: PrimaryKeyValue | Row | undefined,
opts?: any,
) => Promise<any>

- Defined in types.ts:20

### updateWhere

updateWhere: (table: string, data: Row, where: Where) => Promise<any>

- Defined in types.ts:99

### withTransaction

withTransaction: (
fn: () => Promise<any>,
onError?: (e: Error) => Promise<void>,
) => Promise<any>

- Defined in types.ts:40