mysql2-ts-pool
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

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

Package Sidebar

Install

npm i mysql2-ts-pool

Weekly Downloads

4

Version

1.3.2

License

GPL-v3.0

Unpacked Size

30.9 kB

Total Files

11

Last publish

Collaborators

  • izzymg