TdsCdc.Connection behaviour (tds_cdc v0.1.0)

Copy Markdown

Behaviour for database connection adapters used by TdsCdc.

This allows TdsCdc to work with different connection backends:

Example with direct TDS connection

{:ok, pid} = TdsCdc.start_link(
  conn: [hostname: "localhost", username: "sa", password: "pass", database: "mydb"],
  capture_instances: ["dbo_users"]
)

Example with Ecto.Repo

{:ok, pid} = TdsCdc.start_link(
  repo: MyApp.Repo,
  capture_instances: ["dbo_users"]
)

Summary

Types

query_result()

@type query_result() ::
  {:ok, %{rows: list() | nil, columns: list() | nil}} | {:error, term()}

Callbacks

query(conn, t, list)

@callback query(conn :: term(), String.t(), list()) :: query_result()

start_link(keyword)

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

stop(conn)

@callback stop(conn :: term()) :: :ok | {:error, term()}