brook_storage_postgres v0.1.2 Brook.Storage.Postgres.Query View Source

Abstracts the Postgrex SQL query functions away from the storage behaviour implementation.

Collects the command run directly against the Postgrex API in a single location for creates, inserts, selects, and deletes.

Link to this section Summary

Types

The pid of the Postgrex connection process

The serialized and compressed version of a Brook event

The combination of the view application view schema and table in 'schema_name.table_name' format

The timestamp of an event's creation

Link to this section Types

The pid of the Postgrex connection process

The serialized and compressed version of a Brook event

Link to this type

schema_table()

View Source
schema_table() :: String.t()

The combination of the view application view schema and table in 'schema_name.table_name' format

The timestamp of an event's creation

Link to this section Functions

Link to this function

events_table_create(conn, view_table, events_table)

View Source
events_table_create(pid(), schema_table(), schema_table()) ::
  :ok | {:error, Brook.reason()}
Link to this function

postgres_delete(conn, view_table, collection, key)

View Source
postgres_delete(
  conn(),
  schema_table(),
  Brook.view_collection(),
  Brook.view_key()
) :: :ok | {:error, Brook.reason()}
Link to this function

postgres_get(conn, view_table, collection, key \\ nil)

View Source
postgres_get(
  conn(),
  schema_table(),
  Brook.view_collection(),
  Brook.view_key() | nil
) :: {:ok, [Brook.view_value()]} | {:error, Brook.reason()}
Link to this function

postgres_get_events(conn, events_table, collection, key, type \\ nil)

View Source
postgres_get_events(
  conn(),
  schema_table(),
  Brook.view_collection(),
  Brook.view_key(),
  Brook.event_type() | nil
) :: {:ok, [event()]} | {:error, Brook.reason()}
Link to this function

postgres_insert_event(conn, events_table, collection, key, type, timestamp, event)

View Source
postgres_insert_event(
  conn(),
  schema_table(),
  Brook.view_collection(),
  Brook.view_key(),
  Brook.event_type(),
  timestamp(),
  event()
) :: :ok | {:error, Brook.reason()}
Link to this function

postgres_upsert(conn, view_table, collection, key, value)

View Source
postgres_upsert(
  conn(),
  schema_table(),
  Brook.view_collection(),
  Brook.view_key(),
  Brook.view_value()
) :: :ok | {:error, Brook.reason()}
Link to this function

schema_create(conn, schema)

View Source
schema_create(conn(), String.t()) :: :ok | {:error, Brook.reason()}
Link to this function

view_table_create(conn, view_table)

View Source
view_table_create(conn(), schema_table()) :: :ok | {:error, Brook.reason()}