MysqlexPool.Pool (mysqlex_pool v0.2.2)

A library of functions used to create and use a Mysql pool through Mysqlex.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

init mysqlex pool

execute a single sql query

start supervisor

Link to this section Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

init(any()) :: {:ok, tuple()}

init mysqlex pool

Link to this function

query(statement, args)

Specs

query(String.t(), List.t()) :: {:ok, Mysqlex.Result.t()} | {:error, any()}

execute a single sql query

Examples

iex> MysqlexPool.Pool.query( "SELECT ID, Name FROM `city` LIMIT 0,3", [] )
{ :ok, %Mysqlex.Result{columns: ["ID", "Name"], command: :select, last_insert_id: nil, num_rows: 3, rows: [{1, "Kabul"},{2, "Qandahar"}, {3, "Herat"}] } }

Specs

start_link() ::
  {:ok, pid()}
  | :ignore
  | {:error, {:already_started, pid()} | {:shutdown, term()} | term()}

start supervisor