add SetOptions
This commit is contained in:
parent
433cd1f8bc
commit
33d1b2e0ee
|
@ -8,6 +8,20 @@ import (
|
||||||
"gorm.io/gorm/schema"
|
"gorm.io/gorm/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func SetOptions(options *types.SqlOptions) *types.SqlOptions {
|
||||||
|
if options == nil {
|
||||||
|
options = &types.SqlOptions{
|
||||||
|
MaxIdleConns: vars.SqlOptionMaxIdleConns,
|
||||||
|
MaxOpenConns: vars.SqlOptionMaxIdleConns,
|
||||||
|
ConnMaxLifetime: vars.SqlOptionConnMaxLifetime,
|
||||||
|
LogStdout: false,
|
||||||
|
Debug: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
|
}
|
||||||
|
|
||||||
// new grom db.
|
// new grom db.
|
||||||
func NewPostgreSql(dsn string, options *types.SqlOptions) (*gorm.DB, error) {
|
func NewPostgreSql(dsn string, options *types.SqlOptions) (*gorm.DB, error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in New Issue