phantasy-mysql v1.1.2
phantasy-mysql
MySQL Effects
API
createPool
:: PoolOpts -> EffTask {} DbPool ErrorReturns an EffTask that succeeds with a new DbPool or fails with an Error.
getConnection
:: DbPool -> EffTask {} DbConnection ErrorReturns an EffTask that succeeds with a DbConnection from the given DbPool or fails with an Error.
createConnection
:: ConnectionOpts -> EffTask {} DbConnection ErrorReturns an EffTask that succeeds with a new DbConnection or fails with an Error.
query
:: string -> Array mixed -> DbConnection -> EffTask {} QueryResult ErrorReturns 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 ResultRowThe 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.