Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
*config.ConfigBase
// contains filtered or unexported fields
}
DatabaseConfig an in-memory object that represents the configuration for all object stores
func NewDatabaseConfig ¶
func NewDatabaseConfig(baseConfig *config.ConfigBase) (*DatabaseConfig, error)
NewDatabaseConfig will reconcile configuration values from the environment and return a complete config object
func (*DatabaseConfig) GetDSN ¶
func (dbConfig *DatabaseConfig) GetDSN() string
GetDSN getter for dataSourceName
func (*DatabaseConfig) GetDatabaseType ¶
func (dbConfig *DatabaseConfig) GetDatabaseType() DatabaseType
GetDatabaseType getter for databaseType
func (*DatabaseConfig) SetDSN ¶
func (dbConfig *DatabaseConfig) SetDSN(dsn string) error
SetDSN setter for dataSourceName
func (*DatabaseConfig) SetDatabaseType ¶
func (dbConfig *DatabaseConfig) SetDatabaseType(databaseType DatabaseType) error
SetDatabaseType setter for databaseType
type DatabaseImpl ¶
type DatabaseImpl struct {
// contains filtered or unexported fields
}
Database corresponds to a connection to a single database instance
func NewDatabaseImpl ¶
func NewDatabaseImpl(config *DatabaseConfig) (*DatabaseImpl, error)
NewDatabase will return a Database object associated with the provided config, or an error if something went wrong
func (*DatabaseImpl) Close ¶
func (db *DatabaseImpl) Close() error
Close will close the underlying database connection
func (*DatabaseImpl) Get ¶
func (db *DatabaseImpl) Get() *gorm.DB
Get will return the underlying database connection object
func (*DatabaseImpl) Mock ¶
func (db *DatabaseImpl) Mock() sqlmock.Sqlmock
Mock will return the underlying mock expectation object for a mocked database This is used in testing to check expectations
func (*DatabaseImpl) Ping ¶
func (db *DatabaseImpl) Ping() error
Ping will test the underlying database connection
type DatabaseType ¶
type DatabaseType string
const ( MockDatabase DatabaseType = "sqlmock" PostgresDatabase DatabaseType = "postgres" )
type TestDatabase ¶
TestDatabase is the interface to be implemented by all databases that include mocking functionality