Selecto.DB.Adapter behaviour (Selecto v0.3.12)
Behaviour contract for Selecto database adapters.
Adapter modules are responsible for:
- establishing a connection handle from adapter-specific options,
- executing SQL with bound params,
- providing adapter placeholder strategy,
- quoting identifiers when needed by adapter-specific tooling, and
- declaring coarse feature support.
Streaming contract:
supports?(:stream)should returntrueonly whenstream/4is implemented and can produce rows for the given connection context.stream/4is optional; adapters that do not support streaming should omit it and returnfalseforsupports?(:stream).
Link to this section Summary
Link to this section Types
Link to this type
connection()
@type connection() :: term()
Link to this type
connection_options()
Link to this type
execute_options()
@type execute_options() :: keyword()
Link to this type
params()
@type params() :: [term()]
Link to this type
query()
Link to this type
result()
Link to this type
stream_result()
@type stream_result() :: {:ok, Enumerable.t()} | {:ok, Enumerable.t(), [String.t()]} | {:error, term()}
Link to this section Callbacks
Link to this callback
connect(connection_options)
@callback connect(connection_options()) :: {:ok, connection()} | {:error, term()}
Link to this callback
execute(connection, query, params, execute_options)
@callback execute(connection(), query(), params(), execute_options()) :: {:ok, result()} | {:error, term()}
Link to this callback
name()
@callback name() :: atom()
Link to this callback
placeholder(pos_integer)
@callback placeholder(pos_integer()) :: iodata()
Link to this callback
quote_identifier(t)
@callback stream(connection(), query(), params(), execute_options()) :: stream_result()
Link to this callback