Skip to content

DbClientPg

do- edited this page Jan 20, 2023 · 74 revisions

DbClientPg is a thin wrapper above the native PostgreSQL client designed for using in doix Jobs.

Instances are created by DbPoolPg objects, part of Application. Application developers should never instantiate those objects directly.

Properties

Name Description
uuid The unique ID of this client, mainly for logging purposes
raw The pg.Client instance used by this wrapper
model DbModel representing the database structure
lang An instance of DbLangPg or its descendant used for generating/transforming query texts according to PostgreSQL dialect

Events

Name Payload Description
start {sql, params} emitted before executing any database query.
error the error caught emitted when an error occurs while executing a query
finish emitted right after the query execution is terminated (one way or another)

Methods

Name Description
do Execute an arbitrary statement
getScalar Select a single field value
getObject Select a single record as an Object
getArray Select a limited sequence of records as an Array
getStream Select an unlimited sequence of records as a Readable stream

Clone this wiki locally