gaffer_driver_pgo (gaffer v0.5.0)
View SourcePostgres driver for gaffer using pgo.
Summary
Types
PGO driver state.
PGO pool configuration passed to pgo:start_pool/2.
Options for starting the PGO driver.
Functions
Lists known and applied migration versions.
Rolls back migrations down to the given version.
Starts the driver and optionally a pool.
Stop the driver.
Types
-opaque driver_state()
PGO driver state.
-type pool_config() :: map().
PGO pool configuration passed to pgo:start_pool/2.
-type start_opts() :: #{pool := atom(), start => pool_config()}.
Options for starting the PGO driver.
Use a PGO pool with the identifier pool. If start options are supplied, the
driver starts its own PGO pool with that name and those options. Otherwise an
existing pool is used, and ensuring this pool is started is the responsibility
of the user.
Functions
-spec migrations(driver_state()) -> #{all := [non_neg_integer()], applied := [non_neg_integer()], history := [#{version := non_neg_integer(), direction := up | down, created_at := integer()}]}.
Lists known and applied migration versions.
all is the static list of versions known to this binary, sorted ascending.
applied is the derived currently-applied set: the latest direction recorded
per version, filtered to up. history is the append-only log of every up
and down event, oldest first.
-spec rollback(TargetVersion :: non_neg_integer(), driver_state()) -> ok.
Rolls back migrations down to the given version.
Starts the driver and optionally a pool.
Runs any pending migrations.
Stop the driver.
Also stops the connection pool if started by the driver.