Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DBString to format connection string to database for postgres PostgresDBString = "host=%s port=%d dbname=%s user=%s password=%s sslmode=%s" // MySQLDBString to format connection string for MySQL MySQLDBString = "%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local" // DBKey to identify the configuration JSON key DBKey = "db" // Database types DBTypePostgres = "postgres" DBTypeMySQL = "mysql" DBTypeSQLite = "sqlite" )
Variables ¶
This section is empty.
Functions ¶
func LoadDBManagerFile ¶ added in v0.4.9
func LoadDBManagerFile(dbConfigFile string) (*config.YAMLConfigurationDB, error)
LoadDBManagerFile - Function to load DB configuration from YAML file
func PrepareDSN ¶
func PrepareDSN(config config.YAMLConfigurationDB) string
PrepareDSN to generate DB connection string
Types ¶
type DBManager ¶
type DBManager struct {
Conn *gorm.DB
Config *config.YAMLConfigurationDB
DSN string
}
DBManager have access to backend
func CreateDBManager ¶
func CreateDBManager(dbConfig *config.YAMLConfigurationDB) (*DBManager, error)
CreateDBManager to initialize the DB struct
func CreateDBManagerFile ¶
CreateDBManagerFile to load values from YAML file and initialize the DB struct
Click to show internal directories.
Click to hide internal directories.