Documentation ¶
Index ¶
- Constants
- func DisconnectDatabase()
- func GetDatabase() *gorm.DB
- func GetTableName(db *gorm.DB, entityStruct interface{}) (string, error)
- func InitDatabase()
- func InitDatabaseWithConfig(config Config)
- func SetMaxIdleConnections(sqlDB *sql.DB, connections int)
- func SetMaxOpenConnections(sqlDB *sql.DB, connections int)
- type Config
Constants ¶
View Source
const ( DsnStringFormat = "postgres://%s:%s@%s:%s/%s?sslmode=disable&TimeZone=Asia/Kolkata" ConfigKeyDatabasePort = "database.port" ConfigKeyDatabaseHost = "database.host" ConfigKeyDatabaseUserName = "database.username" ConfigKeyDatabasePassword = "database.password" ConfigKeyDatabaseName = "database.name" )
Variables ¶
This section is empty.
Functions ¶
func DisconnectDatabase ¶
func DisconnectDatabase()
DisconnectDatabase closes the connection to database.
func InitDatabase ¶
func InitDatabase()
InitDatabase initializes postgres connection with default yaml configuration keys.
func InitDatabaseWithConfig ¶
func InitDatabaseWithConfig(config Config)
InitDatabaseWithConfig initializes postgres connection with provided configuration.
func SetMaxIdleConnections ¶
func SetMaxOpenConnections ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.