mysql2-ts-pool
v1.3.2
Published
Small TypeScript module for Mysql2 promise pools to provide functions with more predictable return types.
Downloads
2
Readme
mysql2-ts-pool
This is a small TypeScript module that provides the following functions for promise pools.
Mysql2 definitions
- RowDataPacket: Object representing a row returned by the query. Can have any properties.
- FieldPacket: Object containing db metadata.
- OkPacket: Object containing information about the query.
This module will simply typecast the results, so you must use the query for the data you expect.
initPool(options: PoolOptions)
Establishes the exported pool using PoolOptions
async closePool()
Awaits pool.end()
async execFetch(options: QueryOptions)
Runs the execute function, and returns a RowDataPacket
array and a FieldPacket
array.
async execFetchOne(options: QueryOptions)
Runs the execute function, and returns a single RowDataPacket
and a FieldPacket
array.
async queryFetch(options: QueryOptions)
Runs the query function, and returns a RowDataPacket
array and a FieldPacket
array.
async queryFetchOne(options: QueryOptions)
Runs the query function, and returns a single RowDataPacket
and a FieldPacket
array.
async run(options: QueryOptions)
Runs the query function, and returns a single OkPacket
getPool()
Returns raw pool