View Source Adbc.Database (adbc v0.6.5)
Documentation for Adbc.Database
.
Databases are modelled as processes. They required a driver to be started.
Summary
Functions
Returns a specification to start this module under a supervisor.
Get a binary (bytes) type option of the database.
Get a float type option of the database.
Get an integer type option of the database.
Get a string type option of the database.
Set option for the database.
Starts a database process.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Get a binary (bytes) type option of the database.
Get a float type option of the database.
Get an integer type option of the database.
Get a string type option of the database.
@spec set_option( pid(), atom() | String.t(), atom() | {:binary, iodata()} | String.t() | number() ) :: :ok | {:error, String.t()}
Set option for the database.
- If
value
is an atom or a string, then corresponding string option will be set. - If
value
is a{:binary, iodata()}
-tuple, then corresponding binary option will be set. - If
value
is an integer, then corresponding integer option will be set. - If
value
is a float, then corresponding float option will be set.
Starts a database process.
Options
:driver
(required) - the driver to use for this database. It must be an atom (seeAdbc
module documentation for all built-in drivers) or a string representing the path to a driver:process_options
- the options to be given to the underlying process. SeeGenServer.start_link/3
for all options
All other options are given as database options to the underlying driver.
Examples
Adbc.Database.start_link(
driver: :sqlite,
process_options: [name: MyApp.DB]
)
In your supervision tree it would be started like this:
children = [
{Adbc.Database,
driver: :sqlite,
process_options: [name: MyApp.DB]},
]