Documentation ¶
Index ¶
- type Default
- func (f *Default) CheckConnection() error
- func (f *Default) Close() error
- func (f *Default) DirectDB() *sql.DB
- func (f *Default) Init(config *config.DatabaseConfig)
- func (f *Default) New(ctx context.Context) *gorm.DB
- func (f *Default) NewListener(ctx context.Context, channel string, callback func(id string))
- func (f *Default) ResetDB()
- type Test
- func (f *Test) CheckConnection() error
- func (f *Test) Close() error
- func (f *Test) DirectDB() *sql.DB
- func (f *Test) Init(config *config.DatabaseConfig)
- func (f *Test) New(ctx context.Context) *gorm.DB
- func (f *Test) NewListener(ctx context.Context, channel string, callback func(id string))
- func (f *Test) ResetDB()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Default ¶
type Default struct {
// contains filtered or unexported fields
}
func NewProdFactory ¶
func NewProdFactory(config *config.DatabaseConfig) *Default
func (*Default) CheckConnection ¶
func (*Default) Close ¶
Close will close the connection to the database. THIS MUST **NOT** BE CALLED UNTIL THE SERVER/PROCESS IS EXITING!! This should only ever be called once for the entire duration of the application and only at the end.
func (*Default) Init ¶
func (f *Default) Init(config *config.DatabaseConfig)
Init will initialize a singleton connection as needed and return the same instance. Go includes database connection pooling in the platform. Gorm uses the same and provides a method to clone a connection via New(), which is safe for use by concurrent Goroutines.
func (*Default) NewListener ¶
type Test ¶
type Test struct {
// contains filtered or unexported fields
}
func NewTestFactory ¶
func NewTestFactory(config *config.DatabaseConfig) *Test
func (*Test) CheckConnection ¶
CheckConnection checks to ensure a connection is present
func (*Test) Init ¶
func (f *Test) Init(config *config.DatabaseConfig)
Init will: - initialize a template1 DB with migrations - rebuild AMS DB from template1 - return a new connection factory Go includes database connection pooling in the platform. Gorm uses the same and provides a method to clone a connection via New(), which is safe for use by concurrent Goroutines.