mirror of
https://github.com/gogs/gogs.git
synced 2026-05-07 11:06:24 +02:00
database: set Handle direcetly during initialization (#7699)
This commit is contained in:
@@ -128,6 +128,7 @@ func NewConnection(w logger.Writer) (*gorm.DB, error) {
|
||||
TwoFactors = &twoFactorsStore{DB: db}
|
||||
Users = NewUsersStore(db)
|
||||
|
||||
Handle = &DB{db: db}
|
||||
return db, nil
|
||||
}
|
||||
|
||||
@@ -148,11 +149,6 @@ type DB struct {
|
||||
// single-thread process).
|
||||
var Handle *DB
|
||||
|
||||
// SetHandle updates the global database handle with the given connection.
|
||||
func SetHandle(db *gorm.DB) {
|
||||
Handle = &DB{db: db}
|
||||
}
|
||||
|
||||
func (db *DB) AccessTokens() *AccessTokensStore {
|
||||
return newAccessTokensStore(db.db)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user