forked from fasthttp/session
/
types.go
70 lines (55 loc) · 1.55 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package postgre
import (
"time"
"github.com/josephGuo/fastsession/internal/sql"
)
// Config provider settings
type Config struct {
// DB host
Host string
// DB port
Port int64
// DB user name
Username string
// DB user password
Password string
// DB name
Database string
// DB table name
TableName string
// When set to true, this will Drop any existing table with the same name
DropTable bool
// Maximum wait for connection, in seconds. Zero or
// not specified means wait indefinitely.
Timeout time.Duration
// The maximum number of connections in the idle connection pool.
//
// If MaxOpenConns is greater than 0 but less than the new MaxIdleConns,
// then the new MaxIdleConns will be reduced to match the MaxOpenConns limit.
//
// If n <= 0, no idle connections are retained.
//
// The default max idle connections is currently 2. This may change in
// a future release.
MaxIdleConns int
// The maximum number of open connections to the database.
//
// If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than
// MaxIdleConns, then MaxIdleConns will be reduced to match the new
// MaxOpenConns limit.
//
// If n <= 0, then there is no limit on the number of open connections.
// The default is 0 (unlimited).
MaxOpenConns int
// The maximum amount of time a connection may be reused.
//
// Expired connections may be closed lazily before reuse.
//
// If d <= 0, connections are reused forever.
ConnMaxLifetime time.Duration
}
// Provider backend manager
type Provider struct {
config Config
*sql.Provider
}