Documentation
¶
Index ¶
- Constants
- Variables
- func Connect(dbType, dsn string) (err error)
- func Get() (db *gorm.DB, err error)
- func GetRequestDB(tag string, r *http.Request) (db interface{})
- func GetRequestDefaultDB(r *http.Request) (db interface{})
- func GetRequestSpecificDB(fTag feature.Tag, tag string, r *http.Request) (db interface{})
- func MakeRequestDbKey(tag string) (key context.RequestKey)
- func MakeRequestDbSpecificKeys(fTag feature.Tag, tag string) (tagKey, specificKey context.RequestKey)
- func MustGet() (db *gorm.DB)
- func New(dbType, dsn string) (db *gorm.DB, err error)
- func NewWithLoggerConfig(dbType, dsn string, config logger.Config) (db *gorm.DB, err error)
Constants ¶
View Source
const RequestDefaultDbKey context.RequestKey = "DefaultDb"
Variables ¶
View Source
var (
ErrorMissingInstance = fmt.Errorf("missing database instance")
)
View Source
var (
Instance *gorm.DB = nil
)
Functions ¶
func Connect ¶
Connect opens a new database connection and stores it in a package instance for further use with the Get and MustGet functions
func GetRequestDB ¶
func GetRequestDefaultDB ¶
func GetRequestSpecificDB ¶
func MakeRequestDbKey ¶
func MakeRequestDbKey(tag string) (key context.RequestKey)
func MakeRequestDbSpecificKeys ¶
func MakeRequestDbSpecificKeys(fTag feature.Tag, tag string) (tagKey, specificKey context.RequestKey)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.