Documentation
¶
Index ¶
- func RunWithPostgresql(args []string, opts ...PostgresOption) error
- func RunWithPostgresqlDir(dir string, args []string, opts ...PostgresOption) error
- func WithPostgresql(fn func(socketDir string) error, opts ...PostgresOption) error
- func WithPostgresqlDir(dir string, fn func(socketDir string) error, opts ...PostgresOption) error
- type Cluster
- type DatabaseOption
- type Instance
- type Postgres
- type PostgresOption
- type UninitializedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunWithPostgresql ¶
func RunWithPostgresql(args []string, opts ...PostgresOption) error
RunWithPostgresql runs the given command with a temporary PostgreSQL instance available. Connection information is available via the standard PG* environment variables. See https://www.postgresql.org/docs/current/libpq-envars.html
func RunWithPostgresqlDir ¶
func RunWithPostgresqlDir(dir string, args []string, opts ...PostgresOption) error
RunWithPostgresqlDir runs the given command with a PostgreSQL instance available. Data is persisted in the given directory. A cluster is initialized if it doesn't exist. Connection information is available via the standard PG* environment variables. See https://www.postgresql.org/docs/current/libpq-envars.html
func WithPostgresql ¶
func WithPostgresql(fn func(socketDir string) error, opts ...PostgresOption) error
WithPostgresql runs fn after spawning a temporary Postgresql instance
func WithPostgresqlDir ¶
func WithPostgresqlDir(dir string, fn func(socketDir string) error, opts ...PostgresOption) error
WithPostgresqlDir runs fn after spawning a Postgresql instance using dir as its data and socket directory. The cluster will be created in dir if it doesn't exist or is empty
Types ¶
type DatabaseOption ¶
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
func NewInstance ¶
func (*Instance) WithDatabase ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
func NewPostgres ¶
func NewPostgres(opts ...PostgresOption) *Postgres
type PostgresOption ¶
type PostgresOption func(pg *Postgres)
func WithLogOutput ¶
func WithLogOutput(logger *slog.Logger, level slog.Level) PostgresOption
func WithLogStatement ¶
func WithLogStatement(setting string) PostgresOption
WithLogStatement configures postgres' log_statement setting. Possible values are none, ddl, mod and all. Defaults to none.
func WithOutput ¶
func WithOutput(stdout, stderr io.Writer) PostgresOption
func WithoutSync ¶
func WithoutSync() PostgresOption
WithoutSync allows disabling syncing if data integrity isn't important
type UninitializedError ¶
type UninitializedError struct {
// contains filtered or unexported fields
}
func (*UninitializedError) Error ¶
func (e *UninitializedError) Error() string
func (*UninitializedError) Unwrap ¶
func (e *UninitializedError) Unwrap() error