Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionData ¶
type ConnectionData struct {
User string
Password string
Host string
Db string
Port string
SslMode string
SslRootCert string
}
func (ConnectionData) ConnString ¶
func (cd ConnectionData) ConnString() string
func (ConnectionData) DSN ¶
func (cd ConnectionData) DSN() string
type Connector ¶
type Connector interface {
Data() (ConnectionData, error)
}
Connector defines the interface for obtaining database connection information.
type ConnectorFunc ¶
type ConnectorFunc func() (ConnectionData, error)
ConnectorFunc is a helper type for function-only implementations of Connector
func (ConnectorFunc) Data ¶
func (cf ConnectorFunc) Data() (ConnectionData, error)
type DB ¶
type DB struct {
// Name is a bit of a hack, it just allows the CLI consumers to inject the cli name, if needed.
Name string
// contains filtered or unexported fields
}
DB implements the functionality provided by the ezdb package
func (*DB) CreateDatabase ¶
CreateDatabase creates the database, for initial environment setup.
func (*DB) CreateMigration ¶
CreateMigration creates set of migration files with the current timestamp and given name.
func (*DB) MigrateAll ¶
MigrateAll applies all outstanding migrations to the database.
func (*DB) MigrateSteps ¶
MigrateSteps applies a specific number of migrations to the database. If steps are negative, migrations will be rolled back.
type EnvConnector ¶
type EnvConnector struct {
UserKey string
PasswordKey string
HostKey string
DbKey string
PortKey string
SslKey string
SslCertKey string
}
EnvConnector implements Connector by pulling values from environment variables.
func NewDefaultEnvConnector ¶
func NewDefaultEnvConnector() EnvConnector
func (EnvConnector) Data ¶
func (e EnvConnector) Data() (ConnectionData, error)