optimzie of postgres db code

This commit is contained in:
douxu 2026-01-30 17:42:50 +08:00
parent 2126aa7b06
commit 02e0c9c31a
1 changed files with 1 additions and 5 deletions

View File

@ -13,15 +13,11 @@ import (
var (
postgresOnce sync.Once
_globalPostgresClient *gorm.DB
_globalPostgresMu sync.RWMutex
)
// GetPostgresDBClient returns the global PostgresDB client.It's safe for concurrent use.
func GetPostgresDBClient() *gorm.DB {
_globalPostgresMu.RLock()
client := _globalPostgresClient
_globalPostgresMu.RUnlock()
return client
return _globalPostgresClient
}
// InitPostgresDBInstance return instance of PostgresDB client