mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
整理代码
This commit is contained in:
@@ -7,6 +7,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultDatabaseDir = "./data/database"
|
||||||
|
)
|
||||||
|
|
||||||
func NewManage(cfg *ManageConfig, op ...client.Option) (*Manage, error) {
|
func NewManage(cfg *ManageConfig, op ...client.Option) (*Manage, error) {
|
||||||
//初始化配置
|
//初始化配置
|
||||||
if cfg == nil {
|
if cfg == nil {
|
||||||
@@ -16,10 +20,10 @@ func NewManage(cfg *ManageConfig, op ...client.Option) (*Manage, error) {
|
|||||||
cfg.Hosts = Hosts
|
cfg.Hosts = Hosts
|
||||||
}
|
}
|
||||||
if cfg.CodesDir == "" {
|
if cfg.CodesDir == "" {
|
||||||
cfg.CodesDir = "./data/database"
|
cfg.CodesDir = DefaultDatabaseDir
|
||||||
}
|
}
|
||||||
if cfg.WorkdayDir == "" {
|
if cfg.WorkdayDir == "" {
|
||||||
cfg.WorkdayDir = "./data/database"
|
cfg.WorkdayDir = DefaultDatabaseDir
|
||||||
}
|
}
|
||||||
|
|
||||||
//代码
|
//代码
|
||||||
|
|||||||
1
pool.go
1
pool.go
@@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/injoyai/base/safe"
|
"github.com/injoyai/base/safe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NewPool 简易版本的连接池
|
||||||
func NewPool(dial func() (*Client, error), number int) (*Pool, error) {
|
func NewPool(dial func() (*Client, error), number int) (*Pool, error) {
|
||||||
if number <= 0 {
|
if number <= 0 {
|
||||||
number = 1
|
number = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user