Bladeren bron

Update DB

Dima 4 maanden geleden
bovenliggende
commit
d11024adbc
2 gewijzigde bestanden met toevoegingen van 5 en 5 verwijderingen
  1. 2 2
      db/db.go
  2. 3 3
      db/db_config.go

+ 2 - 2
db/db.go

@@ -63,8 +63,8 @@ func NewDB(c Config) (*DB, error) {
 		db.SetMaxIdleConns(int(c.maxIdleConns))
 	}
 
-	if c.maxConnLifetime != nil {
-		db.SetConnMaxLifetime(*c.maxConnLifetime)
+	if c.maxOpenConnLifetime != nil {
+		db.SetConnMaxLifetime(*c.maxOpenConnLifetime)
 	}
 
 	if c.maxIdleConnLifetime != nil {

+ 3 - 3
db/db_config.go

@@ -24,7 +24,7 @@ type Config struct {
 	maxOpenConns uint16
 	maxIdleConns uint16
 
-	maxConnLifetime     *time.Duration
+	maxOpenConnLifetime *time.Duration
 	maxIdleConnLifetime *time.Duration
 }
 
@@ -99,9 +99,9 @@ func WithMaxIdleConns(maxIdleConns uint16) ConfigOption {
 	}
 }
 
-func WithMaxConnLifetime(lifetime time.Duration) ConfigOption {
+func WithMaxOpenConnLifetime(lifetime time.Duration) ConfigOption {
 	return func(s *Config) {
-		s.maxConnLifetime = &lifetime
+		s.maxOpenConnLifetime = &lifetime
 	}
 }