Documentation ¶
Overview ¶
Package postgres provides a Gnomock Preset for PostgreSQL database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Preset ¶
Preset creates a new Gmomock Postgres preset. This preset includes a Postgres specific healthcheck function, default Postgres image and port, and allows to optionally set up initial state.
By default, this preset uses `postgres` user with `password` password, with default database `postgres`. Default PostgresQL version is 12.5.
Types ¶
type Option ¶
type Option func(*P)
Option is an optional configuration of this Gnomock preset. Use available Options to configure the container.
func WithDatabase ¶
WithDatabase creates a database with the provided name in the container. WithQueries, if provided, runs against the new database.
func WithQueries ¶
WithQueries executes the provided queries against the database created with WithDatabase, or against default postgres database.
func WithQueriesFile ¶
WithQueriesFile sets a file name to read initial queries from. Queries from this file are executed before any other queries provided in WithQueries.
func WithTimezone ¶ added in v0.17.0
WithTimezone sets the timezone in this container.
func WithVersion ¶ added in v0.9.0
WithVersion sets image version.
type P ¶
type P struct { DB string `json:"db"` Queries []string `json:"queries"` QueriesFiles []string `json:"queries_files"` User string `json:"user"` Password string `json:"password"` Timezone string `json:"timezone"` Version string `json:"version"` }
P is a Gnomock Preset implementation of PostgreSQL database.
func (*P) Ports ¶
func (p *P) Ports() gnomock.NamedPorts
Ports returns ports that should be used to access this container.