pgdocker

package
v0.0.0-...-1a642c0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package pgdocker creates one-off Postgres docker images to use so sqlgen can introspect the schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client to control the running Postgres Docker container.

func Start

func Start(ctx context.Context, initScripts []string, l *zap.SugaredLogger) (client *Client, mErr error)

Start builds a Docker image and runs the image in a container.

func (*Client) ConnString

func (c *Client) ConnString() (string, error)

ConnString returns the connection string to connect to the started Postgres Docker container.

func (*Client) GetContainerLogs

func (c *Client) GetContainerLogs() (logs string, mErr error)

GetContainerLogs returns a string of all stderr and stdout logs for a container. Useful to enrich output when sqlgen fails to start the Docker container.

func (*Client) Stop

func (c *Client) Stop(ctx context.Context) error

Stop stops the running container, if any.

Jump to

Keyboard shortcuts

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