gaffer_driver_pgo (gaffer v0.2.0)

View Source

Postgres 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

driver_state()

-opaque driver_state()

PGO driver state.

pool_config()

-type pool_config() :: map().

PGO pool configuration passed to pgo:start_pool/2.

start_opts()

-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

migrations/1

-spec migrations(driver_state()) -> #{all := [non_neg_integer()], applied := non_neg_integer()}.

Lists known and applied migration versions.

all is the static list of versions known to this binary, sorted ascending. applied is the version currently recorded in the database. During a downgrade, applied may exceed lists:max(All) if a peer applied a newer version this binary does not know about; callers that care must check for that themselves.

rollback/2

-spec rollback(TargetVersion :: non_neg_integer(), driver_state()) -> ok.

Rolls back migrations down to the given version.

start(Opts)

Starts the driver and optionally a pool.

Runs any pending migrations.

stop(State)

Stop the driver.

Also stops the connection pool if started by the driver.