Documentation ¶
Index ¶
- Variables
- func New(config ManagerConfig) (*Manager, ManagerConfig)
- type Manager
- func (m Manager) ClearTrackedTestDatabases(ctx context.Context, hash string) error
- func (m Manager) Config() ManagerConfig
- func (m *Manager) Connect(ctx context.Context) error
- func (m Manager) DiscardTemplateDatabase(ctx context.Context, hash string) error
- func (m *Manager) Disconnect(ctx context.Context, ignoreCloseError bool) error
- func (m Manager) FinalizeTemplateDatabase(ctx context.Context, hash string) (db.TemplateDatabase, error)
- func (m Manager) GetTestDatabase(ctx context.Context, hash string) (db.TestDatabase, error)
- func (m *Manager) Initialize(ctx context.Context) error
- func (m Manager) InitializeTemplateDatabase(ctx context.Context, hash string) (db.TemplateDatabase, error)
- func (m Manager) Ready() bool
- func (m *Manager) Reconnect(ctx context.Context, ignoreDisconnectError bool) error
- func (m *Manager) RecreateTestDatabase(ctx context.Context, hash string, id int) error
- func (m Manager) ResetAllTracking(ctx context.Context) error
- func (m Manager) ReturnTestDatabase(ctx context.Context, hash string, id int) error
- type ManagerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrManagerNotReady = errors.New("manager not ready") ErrTemplateAlreadyInitialized = errors.New("template is already initialized") ErrTemplateNotFound = errors.New("template not found") ErrTestNotFound = errors.New("test database not found") ErrTemplateDiscarded = errors.New("template is discarded, can't be used") ErrInvalidTemplateState = errors.New("unexpected template state") )
Functions ¶
func New ¶
func New(config ManagerConfig) (*Manager, ManagerConfig)
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func DefaultFromEnv ¶
func DefaultFromEnv() *Manager
func (Manager) ClearTrackedTestDatabases ¶
func (Manager) Config ¶ added in v1.1.0
func (m Manager) Config() ManagerConfig
func (Manager) DiscardTemplateDatabase ¶
func (*Manager) Disconnect ¶
func (Manager) FinalizeTemplateDatabase ¶
func (Manager) GetTestDatabase ¶
GetTestDatabase tries to get a ready test DB from an existing pool.
func (Manager) InitializeTemplateDatabase ¶
func (*Manager) RecreateTestDatabase ¶ added in v1.1.0
RecreateTestDatabase recreates the test DB according to the template and returns it back to the pool.
type ManagerConfig ¶
type ManagerConfig struct { ManagerDatabaseConfig db.DatabaseConfig `json:"-"` // sensitive TemplateDatabaseTemplate string DatabasePrefix string TemplateDatabasePrefix string TestDatabaseOwner string TestDatabaseOwnerPassword string `json:"-"` // sensitive TemplateFinalizeTimeout time.Duration // Time to wait for a template to transition into the 'finalized' state TestDatabaseGetTimeout time.Duration // Time to wait for a ready database PoolConfig pool.PoolConfig }
we explicitly want to access this struct via manager.ManagerConfig, thus we disable revive for the next line
func DefaultManagerConfigFromEnv ¶
func DefaultManagerConfigFromEnv() ManagerConfig
Click to show internal directories.
Click to hide internal directories.