Driver
Method Summary
Public Methods | ||
public |
close(): Promise<void> Close all open sessions and other associated resources. |
|
public |
Acquire a session to communicate with the database. |
|
public |
supportsMultiDb(): Promise<boolean> Returns whether the server supports multi database capabilities based on the protocol version negotiated via handshake. |
|
public |
supportsTransactionConfig(): Promise<boolean> Returns whether the server supports transaction config capabilities based on the protocol version negotiated via handshake. |
|
public |
supportsUserImpersonation(): Promise<boolean> Returns whether the server supports user impersonation capabilities based on the protocol version negotiated via handshake. |
|
public |
verifyConnectivity(param: Object): Promise<ServerInfo> Verifies connectivity of this driver by trying to open a connection with the provided driver options. |
Public Methods
public close(): Promise<void> source
Close all open sessions and other associated resources. You should make sure to use this when you are done with this driver instance.
Return:
Promise<void> | promise resolved when the driver is closed. |
public session(param: Object): Session source
Acquire a session to communicate with the database. The session will borrow connections from the underlying connection pool as required and should be considered lightweight and disposable.
This comes with some responsibility - make sure you always call close when you are done using a session, and likewise, make sure you don't close your session before you are done using it. Once it is closed, the underlying connection will be released to the connection pool and made available for others to use.
Params:
Name | Type | Attribute | Description |
param | Object | The object parameter |
|
param.defaultAccessMode | string |
|
The access mode of this session, allowed values are READ and WRITE. |
param.bookmarks | string | string[] | The initial reference or references to some previous transactions. Value is optional and absence indicates that that the bookmarks do not exist or are unknown. |
|
param.fetchSize | number | The record fetch size of each batch of this session. Use FETCH_ALL to always pull all records in one batch. This will override the config value set on driver config. |
|
param.database | string | The database this session will operate on. |
|
param.impersonatedUser | string | The username which the user wants to impersonate for the duration of the session. |
public supportsMultiDb(): Promise<boolean> source
Returns whether the server supports multi database capabilities based on the protocol version negotiated via handshake.
Note that this function call always causes a round-trip to the server.
Return:
Promise<boolean> | promise resolved with a boolean or rejected with error. |
public supportsTransactionConfig(): Promise<boolean> source
Returns whether the server supports transaction config capabilities based on the protocol version negotiated via handshake.
Note that this function call always causes a round-trip to the server.
Return:
Promise<boolean> | promise resolved with a boolean or rejected with error. |
public supportsUserImpersonation(): Promise<boolean> source
Returns whether the server supports user impersonation capabilities based on the protocol version negotiated via handshake.
Note that this function call always causes a round-trip to the server.
Return:
Promise<boolean> | promise resolved with a boolean or rejected with error. |
public verifyConnectivity(param: Object): Promise<ServerInfo> source
Verifies connectivity of this driver by trying to open a connection with the provided driver options.
Params:
Name | Type | Attribute | Description |
param | Object | The object parameter |
|
param.database | string | The target database to verify connectivity for. |