Documentation
¶
Overview ¶
Package dockerdb allows user to create virtual databases using docker. Tested with PostgreSQL, MySQL, MS SQL.
Index ¶
- Variables
- func Build(conf CustomDB) (connStr string, err error)
- func Pull(ctx context.Context, image DockerHubName) error
- func Run(ctx context.Context, ID string) error
- func SetMaxWaitTime(sec time.Duration)
- type CustomDB
- func (c *CustomDB) SetDBPort(port string) *CustomDB
- func (c *CustomDB) SetEnv(env []string) *CustomDB
- func (c *CustomDB) SetExposePort(port nat.Port) *CustomDB
- func (c *CustomDB) SetName(name string) *CustomDB
- func (c *CustomDB) SetNoSQL() *CustomDB
- func (c *CustomDB) SetPassword(password string) *CustomDB
- func (c *CustomDB) SetSQL() *CustomDB
- func (c *CustomDB) SetSQLConnStr(connString string) *CustomDB
- func (c *CustomDB) SetUser(user string) *CustomDB
- func (c *CustomDB) SetVendor(vendor DockerHubName) *CustomDB
- type DB
- type DockerHubName
- type VDB
- func (ddb *VDB) Clear(ctx context.Context) (err error)
- func (ddb *VDB) Kill(ctx context.Context, signal string) (err error)
- func (ddb *VDB) Pause(ctx context.Context) (err error)
- func (ddb *VDB) Remove(ctx context.Context) (err error)
- func (ddb *VDB) Restart(ctx context.Context) (err error)
- func (ddb *VDB) Run(ctx context.Context) (err error)
- func (ddb *VDB) SQL() (db *sql.DB)
- func (ddb *VDB) Stop(ctx context.Context) (err error)
- func (ddb *VDB) Unpause(ctx context.Context) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknown = errors.New("unknown error") ErrUnsupported = errors.New("unsupported db vendor") )
Functions ¶
func Pull ¶
func Pull(ctx context.Context, image DockerHubName) error
Pull pulls an image from net. WARNING!! USE IT CAREFULLY! DOWNLOADING SOME DB IMAGES MAY TAKE SOME TIME. Tested with PostgreSQL, MySQL, MS SQL.
func SetMaxWaitTime ¶
Types ¶
type CustomDB ¶
type CustomDB struct { DB DB Port string Vendor DockerHubName // Optional if you are using a supported vendor PortDocker nat.Port EnvDocker []string NoSQL bool SQLConnStr string // contains filtered or unexported fields }
func (*CustomDB) SetExposePort ¶ added in v2.2.0
func (*CustomDB) SetPassword ¶ added in v2.2.0
func (*CustomDB) SetSQLConnStr ¶ added in v2.2.0
func (*CustomDB) SetVendor ¶ added in v2.2.0
func (c *CustomDB) SetVendor(vendor DockerHubName) *CustomDB
type DockerHubName ¶ added in v2.2.0
type DockerHubName string
const ( Postgres15 DockerHubName = "postgres:15" Postgres14 DockerHubName = "postgres:14" Postgres13 DockerHubName = "postgres:13" Postgres12 DockerHubName = "postgres:12" Postgres11 DockerHubName = "postgres:11" MySQL5Image DockerHubName = "mysql:5.7" MySQL8Image DockerHubName = "mysql:8" )
type VDB ¶
type VDB struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.