gaffer_postgres (gaffer v0.7.0)
View SourcePure SQL query builder and serializer for Postgres drivers.
Summary
Functions
Query that takes a transaction-scoped advisory lock on the migrations table.
Query that fetches applied versions and their stored SQL checksums.
Query that fetches the currently applied migration versions.
SHA-256 over the concatenated SQL strings of a query list.
Queries to create the applied migrations table if it does not exist.
Query to atomically claim available jobs for execution.
Query to delete a job by ID.
Query to fetch a job by ID.
Query to list jobs matching the given filters.
Query to delete jobs older than per-state cutoffs for a queue.
Returns upsert queries for a single encoded job.
Queries to roll back a migration and remove its applied record.
Queries to apply a migration and record it as applied.
Sorted list of all schema migrations as {Version, Up, Down} tuples.
Query to delete a queue by name.
Query to check whether a queue name exists.
Query to register a queue name. No-op if already registered.
Query to list all registered queue names.
Types
Functions
-spec advisory_lock() -> queries().
Query that takes a transaction-scoped advisory lock on the migrations table.
The lock is released automatically when the surrounding transaction commits or rolls back. Concurrent boots running this query inside their own migrate transaction will serialise on it.
-spec applied_checksums() -> queries().
Query that fetches applied versions and their stored SQL checksums.
-spec applied_versions() -> queries().
Query that fetches the currently applied migration versions.
SHA-256 over the concatenated SQL strings of a query list.
Used to detect post-deploy edits to a migration's up-queries: the value
computed at apply time is stored in gaffer_schema_migrations.sql_checksum
and compared against the recomputed value on every subsequent boot.
-spec ensure_migrations_table() -> queries().
Queries to create the applied migrations table if it does not exist.
Query to atomically claim available jobs for execution.
Query to delete a job by ID.
Query to fetch a job by ID.
Query to list jobs matching the given filters.
-spec job_prune(gaffer:queue(), map()) -> queries().
Query to delete jobs older than per-state cutoffs for a queue.
Returns upsert queries for a single encoded job.
-spec migrate_down({pos_integer(), _, queries()}) -> queries().
Queries to roll back a migration and remove its applied record.
-spec migrate_up({pos_integer(), queries(), _}) -> queries().
Queries to apply a migration and record it as applied.
-spec migrations(Opts :: map()) -> [{Version :: pos_integer(), Up :: queries(), Down :: queries()}].
Sorted list of all schema migrations as {Version, Up, Down} tuples.
-spec queue_delete(gaffer:queue()) -> queries().
Query to delete a queue by name.
-spec queue_exists(gaffer:queue()) -> queries().
Query to check whether a queue name exists.
-spec queue_insert(gaffer:queue()) -> queries().
Query to register a queue name. No-op if already registered.
-spec queue_list() -> queries().
Query to list all registered queue names.