postgres

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

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

Instance is a postgres instance installed by bytebase for backend storage or testing.

func Install

func Install(resourceDir, pgDataDir, pgUser string) (*Instance, error)

Install returns the postgres binary depending on the OS.

func (Instance) Port

func (i Instance) Port() int

Port returns the port number of the postgres instance.

func (*Instance) Start

func (i *Instance) Start(port int, stdout, stderr io.Writer, waitSec int) (err error)

Start starts a postgres instance on given port, outputs to stdout and stderr.

If port is 0, then it will choose a random unused port.

If waitSec > 0, watis at most `waitSec` seconds for the postgres instance to start. Otherwise, returns immediately.

func (*Instance) Stop

func (i *Instance) Stop(stdout, stderr io.Writer) error

Stop stops a postgres instance, outputs to stdout and stderr.

Jump to

Keyboard shortcuts

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