feat:完善入驻信息管理

This commit is contained in:
henry
2021-12-03 15:22:23 +08:00
parent 851a2c1784
commit 911fcf9b1c
16 changed files with 100 additions and 27 deletions

View File

@ -23,8 +23,11 @@ var (
)
type Instance struct {
debug bool
dbMode string
debug bool
dbMode string
tablePrefix string
singularTable bool
maxIdleConns, maxOpenConns, maxLifetime int
*logic.Mysql
*logic.Sqlite
}
@ -43,14 +46,46 @@ func WithDBMode(dbMode string) Option {
}
}
func WithMysqlUser(user string) Option {
func WithTablePrefix(tablePrefix string) Option {
return func(instance *Instance) {
instance.tablePrefix = tablePrefix
}
}
func WithSingularTable(singularTable bool) Option {
return func(instance *Instance) {
instance.singularTable = singularTable
}
}
func WithMaxIdleConns(maxIdleConns int) Option {
return func(instance *Instance) {
instance.maxIdleConns = maxIdleConns
}
}
func WithMaxOpenConns(maxOpenConns int) Option {
return func(instance *Instance) {
instance.maxOpenConns = maxOpenConns
}
}
func WithMaxLifetime(maxLifetime int) Option {
return func(instance *Instance) {
instance.maxLifetime = maxLifetime
}
}
func WithMysqlOption(user string) Option {
return func(instance *Instance) {
instance.Mysql.User = user
}
}
func WithMysql() {
func WithSqliteOption(user string) Option {
return func(instance *Instance) {
instance.Mysql.User = user
}
}
func (this *Instance) Init() {