Documentation ¶
Index ¶
- Constants
- func UniqueName() string
- type MySQL
- func (c *MySQL) ContainerAddress() string
- func (c *MySQL) ContainerID() string
- func (c *MySQL) GetConnectionString() (string, error)
- func (c *MySQL) HostAddress() string
- func (c *MySQL) Run(sigCh <-chan os.Signal, ready chan<- struct{}) error
- func (c *MySQL) Start() error
- func (c *MySQL) Stop() error
- type NameFunc
- type PostgresDB
- func (c *PostgresDB) ContainerAddress() string
- func (c *PostgresDB) ContainerID() string
- func (c *PostgresDB) GetConnectionString() (string, error)
- func (c *PostgresDB) HostAddress() string
- func (c *PostgresDB) Run(sigCh <-chan os.Signal, ready chan<- struct{}) error
- func (c *PostgresDB) Start() error
- func (c *PostgresDB) Stop() error
Constants ¶
const DefaultShutdownTimeout = 10 * time.Second
DefaultShutdownTimeout is the timeout period for stopping a container
const DefaultStartTimeout = 30 * time.Second
DefaultStartTimeout is the timeout period for starting a container
const MySQLDefaultImage = "mysql:5.7"
MySQLDefaultImage is used if none is specified
const PostgresDBDefaultImage = "postgres:9.6"
PostgresDBDefaultImage is used if none is specified
Variables ¶
This section is empty.
Functions ¶
func UniqueName ¶
func UniqueName() string
UniqueName generates a random string for a Docker containers name
Types ¶
type MySQL ¶
type MySQL struct { Client *docker.Client Image string HostIP string HostPort int Name string ContainerPort int StartTimeout time.Duration ShutdownTimeout time.Duration ErrorStream io.Writer OutputStream io.Writer // contains filtered or unexported fields }
MySQL defines a containerized MySQL Server
func (*MySQL) ContainerAddress ¶
ContainerAddress returns the container address where this MySQL instance is available.
func (*MySQL) ContainerID ¶
ContainerID returns the container ID of this MySQL instance
func (*MySQL) GetConnectionString ¶
GetConnectionString returns the sql connection string for connecting to the DB
func (*MySQL) HostAddress ¶
HostAddress returns the host address where this MySQL instance is available.
type NameFunc ¶
type NameFunc func() string
A NameFunc is used to generate container names.
var DefaultNamer NameFunc = UniqueName
DefaultNamer is the default naming function.
type PostgresDB ¶
type PostgresDB struct { Client *docker.Client Image string HostIP string HostPort int Name string ContainerPort int StartTimeout time.Duration ShutdownTimeout time.Duration ErrorStream io.Writer OutputStream io.Writer // contains filtered or unexported fields }
PostgresDB defines a containerized Postgres Server
func (*PostgresDB) ContainerAddress ¶
func (c *PostgresDB) ContainerAddress() string
ContainerAddress returns the container address where this PostgresDB instance is available.
func (*PostgresDB) ContainerID ¶
func (c *PostgresDB) ContainerID() string
ContainerID returns the container ID of this PostgresDB
func (*PostgresDB) GetConnectionString ¶
func (c *PostgresDB) GetConnectionString() (string, error)
GetConnectionString returns the sql connection string for connecting to the DB
func (*PostgresDB) HostAddress ¶
func (c *PostgresDB) HostAddress() string
HostAddress returns the host address where this PostgresDB instance is available.
func (*PostgresDB) Run ¶
func (c *PostgresDB) Run(sigCh <-chan os.Signal, ready chan<- struct{}) error
Run is called by the ifrit runner to start a process
func (*PostgresDB) Start ¶
func (c *PostgresDB) Start() error
Start starts the PostgresDB container using an ifrit runner
func (*PostgresDB) Stop ¶
func (c *PostgresDB) Stop() error
Stop stops and removes the PostgresDB container