PostgreSqlDriver
Hierarchy
- AbstractSqlDriver<PostgreSqlConnection>
- PostgreSqlDriver
Index
Constructors
Properties
Methods
- aggregate
- close
- connect
- convertException
- count
- countVirtual
- createEntityManager
- ensureIndexes
- execute
- find
- findOne
- findVirtual
- getConnection
- getDependencies
- getMetadata
- getPlatform
- init
- loadFromPivotTable
- lockPessimistic
- mapResult
- nativeDelete
- nativeInsert
- nativeInsertMany
- nativeUpdate
- nativeUpdateMany
- reconnect
- setMetadata
- syncCollection
Constructors
constructor
Parameters
config: Configuration<IDatabaseDriver<Connection>>
Returns PostgreSqlDriver
Properties
[EntityManagerType]
readonlyconfig
Methods
aggregate
Parameters
entityName: string
pipeline: any[]
Returns Promise<any[]>
close
Parameters
optionalforce: boolean
Returns Promise<void>
connect
Returns Promise<PostgreSqlConnection>
convertException
Parameters
exception: Error
Returns DriverException
count
Type parameters
- T: object
Parameters
entityName: string
where: any
options: CountOptions<T, never> = {}
Returns Promise<number>
countVirtual
Type parameters
- T: object
Parameters
entityName: string
where: FilterQuery<T>
options: CountOptions<T, any>
Returns Promise<number>
createEntityManager
Type parameters
- D: IDatabaseDriver<Connection, D> = IDatabaseDriver<Connection>
Parameters
optionaluseContext: boolean
Returns D[typeof EntityManagerType]
ensureIndexes
Returns Promise<void>
execute
Type parameters
- T: QueryResult<{ id: number }> | EntityData<Partial<any>> | EntityData<Partial<any>>[] = EntityData<Partial<any>>[]
Parameters
queryOrKnex: string | Raw<any> | QueryBuilder<any, any>
params: any[] = []
method: get | all | run = 'all'
optionalctx: any
Returns Promise<T>
find
Finds selection of entities
Type parameters
- T: object
- P: string = never
Parameters
entityName: string
where: FilterQuery<T>
options: FindOptions<T, P> = {}
Returns Promise<EntityData<T>[]>
findOne
Finds single entity (table row, document)
Type parameters
- T: object
- P: string = never
Parameters
entityName: string
where: FilterQuery<T>
optionaloptions: FindOneOptions<T, P>
Returns Promise<null | EntityData<T>>
findVirtual
Type parameters
- T: object
Parameters
entityName: string
where: FilterQuery<T>
options: FindOptions<T, any>
Returns Promise<EntityData<T>[]>
getConnection
Parameters
type: ConnectionType = 'write'
Returns PostgreSqlConnection
getDependencies
Returns name of the underlying database dependencies (e.g.
mongodb
ormysql2
) for SQL drivers it also returnsknex
in the array as connectors are not used directly thereReturns string[]
getMetadata
Returns MetadataStorage
getPlatform
Returns AbstractSqlPlatform
init
Returns Promise<void>
loadFromPivotTable
When driver uses pivot tables for M:N, this method will load identifiers for given collections from them
Type parameters
- T: object
- O: object
Parameters
prop: EntityProperty<any>
owners: Primary<O>[][]
where: FilterQuery<any> = ...
optionalorderBy: QueryOrderMap<T>[]
optionalctx: any
optionaloptions: FindOptions<T, any>
Returns Promise<Dictionary<T[]>>
lockPessimistic
Type parameters
- T
Parameters
entity: T
options: LockOptions
Returns Promise<void>
mapResult
Type parameters
- T: object
Parameters
result: EntityData<T>
meta: EntityMetadata<T>
populate: PopulateOptions<T>[] = []
optionalqb: QueryBuilder<T>
map: Dictionary = {}
Returns null | EntityData<T>
nativeDelete
Type parameters
- T: object
Parameters
entityName: string
where: any
options: DeleteOptions<T> = {}
Returns Promise<QueryResult<T>>
nativeInsert
Type parameters
- T: object
Parameters
entityName: string
data: EntityDictionary<T>
options: NativeInsertUpdateOptions<T> = {}
Returns Promise<QueryResult<T>>
nativeInsertMany
Type parameters
- T: object
Parameters
entityName: string
data: EntityDictionary<T>[]
options: NativeInsertUpdateManyOptions<T> = {}
Returns Promise<QueryResult<T>>
nativeUpdate
Type parameters
- T: object
Parameters
entityName: string
where: FilterQuery<T>
data: EntityDictionary<T>
options: NativeInsertUpdateOptions<T> & UpsertOptions<T> = {}
Returns Promise<QueryResult<T>>
nativeUpdateMany
Type parameters
- T: object
Parameters
entityName: string
where: FilterQuery<T>[]
data: EntityDictionary<T>[]
options: NativeInsertUpdateManyOptions<T> & UpsertManyOptions<T> = {}
Returns Promise<QueryResult<T>>
reconnect
Returns Promise<PostgreSqlConnection>
setMetadata
Parameters
metadata: MetadataStorage
Returns void
syncCollection
Type parameters
- T: object
- O: object
Parameters
coll: Collection<T, O>
optionaloptions: DriverMethodOptions
Returns Promise<void>
Converts native db errors to standardized driver exceptions