Snowflex. Transport behaviour
(Snowflex v1.6.0)
View Source
Behaviour module that defines the interface for Snowflake transport implementations.
See Snowflex.Transport.Http for the default implementation.
Summary
Callbacks
Clean up cursor state after streaming is complete. See DBConnection.handle_deallocate/4 for more information.
Declare a statement (primarily for streaming) and return a cursor.
See DBConnection.handle_declare/4 for more information.
Disconnect from the database. See DBConnection.handle_close/3 for more information.
Execute a statement. See DBConnection.handle_execute/4 for more information.
Fetch the next result from a cursor. Return {:ok, result} while the cursor
may still hold more results and {:halt, result} once it is exhausted.
See DBConnection.handle_fetch/4 for more information.
Periodic pings to the server, default is once per second. See DBConnection.ping/1 for more information.
Types
@type connection_opts() :: Keyword.t()
@type cursor() :: term()
@type fetch_result() :: {:ok, Snowflex.Result.t()} | {:halt, Snowflex.Result.t()} | {:error, Snowflex.Error.t()}
@type query_result() :: {:ok, Snowflex.Result.t()} | {:error, Snowflex.Error.t()}
Callbacks
@callback deallocate(pid()) :: :ok
Clean up cursor state after streaming is complete. See DBConnection.handle_deallocate/4 for more information.
@callback declare(pid(), String.t(), any(), Keyword.t()) :: {:ok, cursor()} | {:error, Snowflex.Error.t()}
Declare a statement (primarily for streaming) and return a cursor.
See DBConnection.handle_declare/4 for more information.
@callback disconnect(pid()) :: :ok
Disconnect from the database. See DBConnection.handle_close/3 for more information.
@callback execute_statement(pid(), String.t(), any(), Keyword.t()) :: query_result()
Execute a statement. See DBConnection.handle_execute/4 for more information.
@callback fetch(pid(), cursor(), Keyword.t()) :: fetch_result()
Fetch the next result from a cursor. Return {:ok, result} while the cursor
may still hold more results and {:halt, result} once it is exhausted.
See DBConnection.handle_fetch/4 for more information.
@callback ping(pid()) :: query_result()
Periodic pings to the server, default is once per second. See DBConnection.ping/1 for more information.
@callback start_link(connection_opts()) :: GenServer.on_start()