database

package
v0.389.0-next.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(reset bool, projectDirectory string) (*db.ConnectionInfo, error)

You have to specify if you want the database contents for THIS project to be reset (cleared) or retained.

You don't need to have a Postgres Docker image already available - because it will go and fetch one if necessary the first time.

It creates and starts a fresh docker container each time in order to be able to serve Postgres on a port that is free on the host, RIGHT NOW. It favours port 5432 when possible.

However it manages a "live forever" Docker Volume and tells Postgres to persist the database contents to that volume. Consequently the Volume and the data are long lived, while the container is ephemeral.

It names the default database to be 'postgres' and sets the pg password also to "postgres".

The connection info it returns refers to the project-specific database.

func Stop

func Stop() error

Stop stops the postgres container - having checked first that such a container exists, and it is running.

This is no longer strictly necessary now, but it seems likely the user would prefer not to have needless containers running. In fact we could with this new architecture delete the container at this point. It get's deleted anyhow when you next run Keel run. But it leaving it as it was because its harmless.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL