View Source Statestores.Adapters.PostgresProjectionAdapter (spawn_statestores_postgres v2.0.0-RC13)
Implements the ProjectionBehaviour for Postgres, with dynamic table name support.
Summary
Functions
Dynamically creates or updates a table in the PostgreSQL database from a Protobuf module.
Performs a raw query and returns the results.
Performs an upsert (insert or update) of data in the table.
Functions
Dynamically creates or updates a table in the PostgreSQL database from a Protobuf module.
Parameters
repo
: The module from the Ecto repository.protobuf_module
: The Elixir module generated from a Protobuf file.table_name
: Name of the table to be created or updated in the database.
Example
iex> create_or_update_table(MyProtobufModule, "my_table")
Performs a raw query and returns the results.
Parameters
repo
: The Ecto repository module.query
: The raw SQL query string with named parameters (e.g., :id).params
: A map of parameter values.
Returns the result rows as a list of maps.
Examples
iex> results = query("SELECT age, metadata FROM example WHERE id = :id", %{id: "value"}) {:ok, [%{age: 30, metadata: "example data"}]}
Performs an upsert (insert or update) of data in the table.
Parameters
repo
: The Ecto repository module.protobuf_module
: The Elixir module generated from a Protobuf file.table_name
: Name of the table in the database.data
: Protobuf structure containing the data to be inserted or updated.
Returns :ok
on success.