add recorder
This commit is contained in:
parent
7098529421
commit
ef4ad92e35
|
@ -394,5 +394,9 @@ func Init(ctx context.Context, cbs ...Option) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !opts.disableRecorder {
|
||||||
|
//启用操作记录
|
||||||
|
NewActivityRecorder(ctx, opts.db).Recoder()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
27
types.go
27
types.go
|
@ -20,16 +20,17 @@ var (
|
||||||
|
|
||||||
type (
|
type (
|
||||||
options struct {
|
options struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
domain string
|
domain string
|
||||||
moduleName string
|
moduleName string
|
||||||
apiPrefix string //接口前缀
|
apiPrefix string //接口前缀
|
||||||
viewPrefix string //生成菜单View的前缀路径
|
viewPrefix string //生成菜单View的前缀路径
|
||||||
vuePath string //生成Vue文件的路径,如果指定了启动的时候会自动生成Vue的文件
|
vuePath string //生成Vue文件的路径,如果指定了启动的时候会自动生成Vue的文件
|
||||||
translate Translate
|
translate Translate
|
||||||
disableDefault bool
|
disableDefault bool
|
||||||
httpServer *http.Server
|
disableRecorder bool
|
||||||
restOpts []rest.Option
|
httpServer *http.Server
|
||||||
|
restOpts []rest.Option
|
||||||
}
|
}
|
||||||
|
|
||||||
Option func(*options)
|
Option func(*options)
|
||||||
|
@ -68,6 +69,12 @@ func WithoutDefault() Option {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithoutRecorder() Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.disableRecorder = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func WithHttpServer(server *http.Server) Option {
|
func WithHttpServer(server *http.Server) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
o.httpServer = server
|
o.httpServer = server
|
||||||
|
|
Loading…
Reference in New Issue