db_session

package
v0.0.0-...-eddc46d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

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 (f *Default) CheckConnection() error

func (*Default) Close

func (f *Default) Close() error

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) DirectDB

func (f *Default) DirectDB() *sql.DB

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) New

func (f *Default) New(ctx context.Context) *gorm.DB

func (*Default) NewListener

func (f *Default) NewListener(ctx context.Context, channel string, callback func(id string))

func (*Default) ResetDB

func (f *Default) ResetDB()

type Test

type Test struct {
	// contains filtered or unexported fields
}

func NewTestFactory

func NewTestFactory(config *config.DatabaseConfig) *Test

func (*Test) CheckConnection

func (f *Test) CheckConnection() error

CheckConnection checks to ensure a connection is present

func (*Test) Close

func (f *Test) Close() error

func (*Test) DirectDB

func (f *Test) DirectDB() *sql.DB

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.

func (*Test) New

func (f *Test) New(ctx context.Context) *gorm.DB

func (*Test) NewListener

func (f *Test) NewListener(ctx context.Context, channel string, callback func(id string))

func (*Test) ResetDB

func (f *Test) ResetDB()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL