- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for SetConnMaxLifetime (0.18 sec)
-
src/database/sql/example_service_test.go
db, err := sql.Open("driver-name", "database=test1") if err != nil { // This will not be a connection error, but a DSN parse error or // another initialization error. log.Fatal(err) } db.SetConnMaxLifetime(0) db.SetMaxIdleConns(50) db.SetMaxOpenConns(50) s := &Service{db: db} http.ListenAndServe(":8080", s) } type Service struct { db *sql.DB }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Feb 28 20:21:26 UTC 2024 - 4K bytes - Viewed (0) -
src/database/sql/sql_test.go
t.Errorf("closes = %d; want 0", closes) } if g, w := db.numFreeConns(), 2; g != w { t.Errorf("free conns = %d; want %d", g, w) } // Expire first conn offset = 11 * time.Second db.SetConnMaxLifetime(10 * time.Second) tx, err = db.Begin() if err != nil { t.Fatal(err) } tx2, err = db.Begin() if err != nil { t.Fatal(err) } tx.Commit() tx2.Commit()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 18:42:28 UTC 2024 - 111.6K bytes - Viewed (0) -
src/database/sql/sql.go
db.mu.Unlock() if syncMaxIdle { db.SetMaxIdleConns(n) } } // SetConnMaxLifetime sets the maximum amount of time a connection may be reused. // // Expired connections may be closed lazily before reuse. // // If d <= 0, connections are not closed due to a connection's age. func (db *DB) SetConnMaxLifetime(d time.Duration) { if d < 0 { d = 0 } db.mu.Lock()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:16:53 UTC 2024 - 103.6K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go
{"(*DB).Query", Method, 0}, {"(*DB).QueryContext", Method, 8}, {"(*DB).QueryRow", Method, 0}, {"(*DB).QueryRowContext", Method, 8}, {"(*DB).SetConnMaxIdleTime", Method, 15}, {"(*DB).SetConnMaxLifetime", Method, 6}, {"(*DB).SetMaxIdleConns", Method, 1}, {"(*DB).SetMaxOpenConns", Method, 2}, {"(*DB).Stats", Method, 5}, {"(*Null).Scan", Method, 22}, {"(*NullBool).Scan", Method, 0},
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 02:20:05 UTC 2024 - 534.2K bytes - Viewed (0)