upd(vendor): update factory db with MustGet()
This commit is contained in:
Generated
+1
-1
@@ -93,7 +93,7 @@
|
||||
".",
|
||||
"resputil"
|
||||
]
|
||||
revision = "48ba0357b31ad368f66fa2441bd23c12757c56a0"
|
||||
revision = "382da457432419256cfbcf8806efcc1470adb60f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
||||
+9
@@ -131,6 +131,15 @@ func (r *DatabaseFactory) Get(dbName ...string) (*DB, error) {
|
||||
return nil, fmt.Errorf("No configuration found for database: %v", names)
|
||||
}
|
||||
|
||||
// MustGet is the same as Get, except it will panic on connection error
|
||||
func (r *DatabaseFactory) MustGet(dbName ...string) *DB {
|
||||
db, err := r.Get(dbName...)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
||||
// DB struct encapsulates sqlx.DB to add new functions
|
||||
type DB struct {
|
||||
*sqlx.DB
|
||||
|
||||
Reference in New Issue
Block a user