Documentation
¶
Index ¶
Constants ¶
View Source
const (
// Driver defines the driver name
Driver = "postgres"
)
Variables ¶
View Source
var ( // ErrDBOpen returned when db open fails ErrDBOpen = errors.New("error opening database") // ErrMigrationLoad returned when migrations cannot be loaded ErrMigrationLoad = errors.New("error loading new migrations") // ErrCreateDBInstance returned when db instance creation fails ErrCreateDBInstance = errors.New("error while creating a new DB instance") // ErrDBMigrationFailed returned when db migration fails ErrDBMigrationFailed = errors.New("db migration failed") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string `env:"DB_NAME"` User string `env:"DB_USER"` Password string `env:"DB_PASS"` Driver string `env:"DB_DRIVER,default=postgres"` Host string `env:"DB_HOST,default=localhost"` Port int `env:"DB_PORT,default=5432"` SSLMode string `env:"DB_SSL_MODE,default=disable"` MigrationsPath string `env:"DB_MIGRATIONS_PATH"` }
Config holds database configuration
type Initializer ¶
type Initializer struct {
// contains filtered or unexported fields
}
func NewInitializer ¶
func NewInitializer(pg *Postgres) *Initializer
NewInitializer returns a new JetStream Initialiazer
func (*Initializer) AddDependency ¶
func (i *Initializer) AddDependency(dep interface{}) error
AddDependency adds necessary service components as dependencies
func (*Initializer) CanRun ¶
func (i *Initializer) CanRun() bool
CanRun returns true if the component has anything to Run
func (*Initializer) CanStop ¶
func (i *Initializer) CanStop() bool
CanRun returns true if the component has anything to Run
func (*Initializer) Dependencies ¶
func (i *Initializer) Dependencies() []string
Dependencies returns the string names of service components that are required as dependencies for this component
type Postgres ¶
Postgres contains database instance
func NewPostgres ¶
func NewPostgres() *Postgres
NewPostgres returns new connection to the postgres db
func (*Postgres) HasInitializer ¶
func (*Postgres) Initializer ¶
func (db *Postgres) Initializer() component.Initializer
Click to show internal directories.
Click to hide internal directories.