Documentation ¶
Overview ¶
Package stratus is a lazy implementation of a singleton pattern for a single database. The current implementation does not support multiple database. Will cross that bridge when needed. For now, this is sufficient. It is assumed that the database will be initialized from within `cmd/main.go` by calling `stratus.Connect`, and that the `GetInstance()` function will be used to load the reference into other services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Connect opens the connection to the database through GORM. Will panic if a connection fails, will return an error if issues arise when trying to set DB options.
func GetInstance ¶
GetInstance is a lazy devs attempt to provide a singleton to the primary db instance. GetInstance will panic if the database has not been initialized by calling `db.Connect`.
func WithMaxConnections ¶
WithMaxConnections allows for the setting of `MaxOpenConns` for the underlying `*sql.DB` instance during database initialization.
Types ¶
This section is empty.