View Source Electric.Shapes.Api (electric v1.0.1)

Summary

Types

@type options() :: [
  inspector: {module(), [term()]},
  pg_id: nil | binary(),
  registry: atom(),
  shape_cache: {module(), [term()]},
  stack_events_registry: atom(),
  stack_id: binary(),
  storage: {module(), [term()]},
  persistent_kv: term(),
  allow_shape_deletion: boolean(),
  long_poll_timeout: integer(),
  max_age: integer(),
  stack_ready_timeout: integer(),
  stale_age: integer(),
  send_cache_headers?: boolean(),
  encoder: atom()
]
@type shape_opts() :: [
  relation: {binary(), binary()},
  where: binary() | nil,
  columns: [binary()] | nil,
  params: %{optional(binary()) => binary()},
  replica: term(),
  storage: nil | Electric.Shapes.Shape.storage_config(),
  table: binary(),
  schema: binary(),
  namespace: binary()
]
@type t() :: %Electric.Shapes.Api{
  allow_shape_deletion: term(),
  configured: term(),
  encoder: term(),
  inspector: term(),
  long_poll_timeout: term(),
  max_age: term(),
  persistent_kv: term(),
  pg_id: term(),
  registry: term(),
  send_cache_headers?: term(),
  shape: term(),
  shape_cache: term(),
  stack_events_registry: term(),
  stack_id: term(),
  stack_ready_timeout: term(),
  stale_age: term(),
  storage: term()
}

Functions

@spec delete_shape(Electric.Shapes.Api.Request.t()) ::
  Electric.Shapes.Api.Response.t()
@spec delete_shape(Plug.Conn.t()) :: Plug.Conn.t()
Link to this function

delete_shape(conn, request)

View Source
Link to this function

encode_message(api, message)

View Source
@spec encode_message(t() | Electric.Shapes.Api.Request.t(), term()) :: Enum.t()
Link to this function

if_not_modified(conn, request)

View Source
@spec options(Plug.Conn.t()) :: Plug.Conn.t()
Link to this function

predefined_shape(api, shape_params)

View Source
@spec predefined_shape(t(), shape_opts()) :: {:ok, t()} | {:error, term()}

Create a version of the given configured Api instance that is specific to the given shape.

This allows you to provide a locked-down version of the API that ignores shape-definition parameters such as table, where and columns and only honours the shape-tailing parameters such as offset and handle.

Link to this function

serve_shape_log(request)

View Source

Return shape log data.

Link to this function

serve_shape_log(conn, request)

View Source
@spec stack_id(t() | Electric.Shapes.Api.Request.t()) :: String.t()
@spec validate(t(), %{required(atom() | binary()) => term()}) ::
  {:ok, Electric.Shapes.Api.Request.t()}
  | {:error, Electric.Shapes.Api.Response.t()}

Validate the parameters for the request.

Link to this function

validate_for_delete(api, params)

View Source
@spec validate_for_delete(t(), %{required(atom() | binary()) => term()}) ::
  {:ok, Electric.Shapes.Api.Request.t()}
  | {:error, Electric.Shapes.Api.Response.t()}