Gel.Client (Gel v0.9.0)
View SourceСlient is a structure that stores a custom configuration to execute EdgeQL queries and has a reference to a connection or pool of connections.
After starting the pool via Gel.start_link/1 or siblings,
the client instance for the pool will be implicitly registered.
In case you want to change the behavior of your queries, you will use the Gel.Client,
which is acceptable by all Gel API and will be provided to you in a callback
in the Gel.transaction/3 function.
Summary
Types
Options for transactions and read-only queries retries.
Options for a retry rule for transactions retries.
Client is structure with stored configuration for executing EdgeQL queries and reference to pool or connection.
Options for Gel transactions.
Types
@type retry_option() :: {:transaction_conflict, retry_rule()} | {:network_error, retry_rule()}
Options for transactions and read-only queries retries.
See Gel.transaction/3.
Supported options:
:transaction_conflict- the rule that will be used in case of any transaction conflict.:network_error- rule which will be used when any network error occurs on the client.
@type retry_rule() :: {:attempts, pos_integer()} | {:backoff, (pos_integer() -> timeout())}
Options for a retry rule for transactions retries.
See Gel.transaction/3.
Supported options:
:attempts- the number of attempts to retry the transaction in case of an error.:backoff- function to determine the backoff before the next attempt to run a transaction.
@type t() :: %Gel.Client{ conn: DBConnection.conn(), readonly: boolean(), retry_options: [retry_option()], state: Gel.Client.State.t(), transaction_options: [transaction_option()] }
Client is structure with stored configuration for executing EdgeQL queries and reference to pool or connection.
Fields:
:conn- reference to connection or pool of connections.:readonly- flag specifying that the client is read-only.:transaction_options- options for Gel transactions.:retry_options- options for a retry rule for transactions retries.:state- execution context that affects the execution of EdgeQL commands.
@type transaction_option() :: {:isolation, :serializable} | {:readonly, boolean()} | {:deferrable, boolean()}
Options for Gel transactions.
These options are responsible for building the appropriate EdgeQL statement to start transactions and they correspond to the EdgeQL transaction statement.
Supported options:
:isolation- If:serializableis used, the built statement will use theisolation serializablemode. Currently only:serializableis supported by this client and Gel.:readonly- if set totruethen the built statement will useread onlymode, otherwiseread writewill be used. The default isfalse.:deferrable- if set totruethen the built statement will usedeferrablemode, otherwisenot deferrablewill be used. The default isfalse.