Documentation
¶
Index ¶
- Constants
- type PostgresDriver
- func (pd *PostgresDriver) ClearTables(container mconfig.ContainerInformation) error
- func (pd *PostgresDriver) CreateContainer(ctx context.Context, c *client.Client, a mconfig.ContainerAllocation) (string, error)
- func (pd *PostgresDriver) DropTables(container mconfig.ContainerInformation) error
- func (pd *PostgresDriver) GetImage() string
- func (pd *PostgresDriver) GetRequiredPortAmount() int
- func (pd *PostgresDriver) GetUniqueId() string
- func (pd *PostgresDriver) HandleInstruction(ctx context.Context, c *client.Client, container mconfig.ContainerInformation, ...) error
- func (pd *PostgresDriver) Host(ctx *mconfig.Context) mconfig.EnvironmentValue
- func (pd *PostgresDriver) Initialize(ctx context.Context, c *client.Client, container mconfig.ContainerInformation) error
- func (pd *PostgresDriver) IsHealthy(ctx context.Context, c *client.Client, container mconfig.ContainerInformation) (bool, error)
- func (pd *PostgresDriver) Load(data string) (mconfig.ServiceDriver, error)
- func (pd *PostgresDriver) NewDatabase(name string) *PostgresDriver
- func (pd *PostgresDriver) Password() mconfig.EnvironmentValue
- func (pd *PostgresDriver) Port(ctx *mconfig.Context) mconfig.EnvironmentValue
- func (pd *PostgresDriver) Save() (string, error)
- func (pd *PostgresDriver) Username() mconfig.EnvironmentValue
Constants ¶
const ( PostgresUsername = "postgres" PostgresPassword = "postgres" )
IMPORTANT: Having non-static passwords would make Magic not works as the Container allocation currently does not contain service driver data.
This means that instruction calling would break if we added back password and username changing.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresDriver ¶
func NewDriver ¶
func NewDriver(image string) *PostgresDriver
Create a new PostgreSQL service driver.
It currently supports PostgreSQL 18.
func (*PostgresDriver) ClearTables ¶
func (pd *PostgresDriver) ClearTables(container mconfig.ContainerInformation) error
Clear all tables in all databases (keeps table schema alive, just removes the content of all tables)
func (*PostgresDriver) CreateContainer ¶
func (pd *PostgresDriver) CreateContainer(ctx context.Context, c *client.Client, a mconfig.ContainerAllocation) (string, error)
Should create a new container for the database or use the existing one (returns container id + error in case one happened)
func (*PostgresDriver) DropTables ¶
func (pd *PostgresDriver) DropTables(container mconfig.ContainerInformation) error
Drop all tables in all databases (actually deletes all of your tables)
func (*PostgresDriver) GetImage ¶
func (pd *PostgresDriver) GetImage() string
func (*PostgresDriver) GetRequiredPortAmount ¶
func (pd *PostgresDriver) GetRequiredPortAmount() int
func (*PostgresDriver) GetUniqueId ¶
func (pd *PostgresDriver) GetUniqueId() string
A unique identifier for the database driver. This is appended to the container name to make sure we know it's the container from the driver.
func (*PostgresDriver) HandleInstruction ¶
func (pd *PostgresDriver) HandleInstruction(ctx context.Context, c *client.Client, container mconfig.ContainerInformation, instruction mconfig.Instruction) error
Handles the instructions for PostgreSQL. Supports the following instructions currently: - Clear tables - Drop tables
func (*PostgresDriver) Host ¶
func (pd *PostgresDriver) Host(ctx *mconfig.Context) mconfig.EnvironmentValue
Get hostname of the database container created by the driver as a EnvironmentValue for your config.
func (*PostgresDriver) Initialize ¶
func (pd *PostgresDriver) Initialize(ctx context.Context, c *client.Client, container mconfig.ContainerInformation) error
Initialize the internal container with a script (for example)
func (*PostgresDriver) IsHealthy ¶
func (pd *PostgresDriver) IsHealthy(ctx context.Context, c *client.Client, container mconfig.ContainerInformation) (bool, error)
Check for postgres health
func (*PostgresDriver) Load ¶
func (pd *PostgresDriver) Load(data string) (mconfig.ServiceDriver, error)
func (*PostgresDriver) NewDatabase ¶
func (pd *PostgresDriver) NewDatabase(name string) *PostgresDriver
func (*PostgresDriver) Password ¶
func (pd *PostgresDriver) Password() mconfig.EnvironmentValue
Get the password for the user of the databases in this driver as a EnvironmentValue for your config.
func (*PostgresDriver) Port ¶
func (pd *PostgresDriver) Port(ctx *mconfig.Context) mconfig.EnvironmentValue
Get the port of the database container created by the driver as a EnvironmentValue for your config.
func (*PostgresDriver) Save ¶
func (pd *PostgresDriver) Save() (string, error)
func (*PostgresDriver) Username ¶
func (pd *PostgresDriver) Username() mconfig.EnvironmentValue
Get the username of the databases in this driver as a EnvironmentValue for your config.