phantasy-mysql

1.1.2 • Public • Published

phantasy-mysql

Build Status Coverage Status

MySQL Effects

API

createPool

:: PoolOpts -> EffTask {} DbPool Error

Returns an EffTask that succeeds with a new DbPool or fails with an Error.

getConnection

:: DbPool -> EffTask {} DbConnection Error

Returns an EffTask that succeeds with a DbConnection from the given DbPool or fails with an Error.

createConnection

:: ConnectionOpts -> EffTask {} DbConnection Error

Returns an EffTask that succeeds with a new DbConnection or fails with an Error.

query

:: string -> Array mixed -> DbConnection -> EffTask {} QueryResult Error

Returns an EffTask that succeeds with the QueryResult or fails with an Error.

Types

PoolOpts

{
	host: string,
	port?: number,
	user?: string,
	password?: string,
	database: string,
	connectionLimit: number
}

Options when creating a DbPool.

ConnectionOpts

{
	host: string,
	port?: number,
	user?: string,
	password?: string,
	database: string
}

Options when creating a DbConnection.

DbPool

Represents a pool of database connections.

DbConnection

Represents a single database connection.

QueryResult

ResultInfo | Array ResultRow

The result of a query. It is either a ResultInfo object or an array of ResultRow objects.

ResultInfo

{
	affectedRows: number
}

The result of a query that does not return results.

ResultRow

{
		[k: string]: number | string
}

A single row in the result set of a query. It is an object with string keys and values that are type of either number or string.

Readme

Keywords

Package Sidebar

Install

npm i phantasy-mysql

Weekly Downloads

7

Version

1.1.2

License

MIT

Last publish

Collaborators

  • tkuminecz