✏ refactor storage

This commit is contained in:
Fenny
2020-11-04 20:49:53 +01:00
parent b29989b82e
commit a6058cffb3
22 changed files with 705 additions and 614 deletions

View File

@@ -30,9 +30,6 @@ store := sqlite3.New(sqlite3.Config{
Database: "./fiber.sqlite3",
TableName: "fiber",
DropTable: false,
MaxOpenConns: 100,
MaxIdleConns: 100,
ConnMaxLifetime: 1 * time.Second,
})
```
@@ -56,36 +53,6 @@ type Config struct {
// When set to true, this will Drop any existing table with the same name
DropTable bool
// 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 is 100.
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 100.
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.
//
// The default is 1 * time.Second
ConnMaxLifetime time.Duration
}
```
@@ -96,8 +63,5 @@ var ConfigDefault = Config{
Database: "./fiber.sqlite3",
TableName: "fiber",
DropTable: false,
MaxOpenConns: 100,
MaxIdleConns: 100,
ConnMaxLifetime: 1 * time.Second,
}
```