Snowflex.Transport behaviour (Snowflex v1.2.1)

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). 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. 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

connection_opts()

@type connection_opts() :: Keyword.t()

query_result()

@type query_result() :: {:ok, Snowflex.Result.t()} | {:error, Snowflex.Error.t()}

Callbacks

deallocate(pid)

@callback deallocate(pid()) :: :ok

Clean up cursor state after streaming is complete. See DBConnection.handle_deallocate/4 for more information.

declare(pid, t, any, t)

@callback declare(pid(), String.t(), any(), Keyword.t()) :: query_result()

Declare a statement (primarily for streaming). See DBConnection.handle_declare/4 for more information.

disconnect(pid)

@callback disconnect(pid()) :: :ok

Disconnect from the database. See DBConnection.handle_close/3 for more information.

execute_statement(pid, t, any, t)

@callback execute_statement(pid(), String.t(), any(), Keyword.t()) :: query_result()

Execute a statement. See DBConnection.handle_execute/4 for more information.

fetch(pid, t, t)

@callback fetch(pid(), String.t(), Keyword.t()) :: query_result()

Fetch the next result from a cursor. See DBConnection.handle_fetch/4 for more information.

ping(pid)

@callback ping(pid()) :: query_result()

Periodic pings to the server, default is once per second. See DBConnection.ping/1 for more information.

start_link(connection_opts)

@callback start_link(connection_opts()) :: GenServer.on_start()