Documentation ¶
Overview ¶
Spawns a PostgreSQL server with a single database configured. Ideal for unit tests where you want a clean instance each time. Then clean up afterwards.
Requires PostgreSQL to be installed on your system (but it doesn't have to be running).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PG ¶
func Start ¶
Start a new PostgreSQL database, on temporary storage.
This database has fsync disabled for performance, so it might run faster than your production database. This makes it less reliable in case of system crashes, but we don't care about that anyway during unit testing.
Use the DB field to access the database connection.
func StartPersistent ¶
Starts a new PostgreSQL database
Will listen on a unix socket and initialize the database in the given folder, if needed. Data isn't removed when calling Stop(), so this database can be used multiple times. Allows using PostgreSQL as an embedded databases (such as SQLite). Not for production usage!
type PGConfig ¶
type PGConfig struct { BinDir string // Directory to look for postgresql binaries including initdb, postgres Dir string // Directory for storing database files, removed for non-persistent configs IsPersistent bool // Whether to make the current configuraton persistent or not }