@@ -12,6 +12,8 @@ type CbOperationLogType string
1212
1313const (
1414 CbOperationLogTypeSql CbOperationLogType = "SQL"
15+
16+ CbExecOpSuccess = "Success"
1517)
1618
1719// CbOperationLogRepo 定义操作日志的存储接口
@@ -21,6 +23,7 @@ type CbOperationLogRepo interface {
2123 UpdateCbOperationLog (ctx context.Context , log * CbOperationLog ) error
2224 ListCbOperationLogs (ctx context.Context , opt * ListCbOperationLogOption ) ([]* CbOperationLog , int64 , error )
2325 CleanCbOperationLogOpTimeBefore (ctx context.Context , t time.Time ) (int64 , error )
26+ CountOperationLogs (ctx context.Context , opt * ListCbOperationLogOption ) (int64 , error )
2427}
2528
2629// CbOperationLog 代表操作日志记录
@@ -42,6 +45,7 @@ type CbOperationLog struct {
4245
4346 User * User
4447 DbService * DBService
48+ Project * Project
4549}
4650
4751func (c CbOperationLog ) GetOpTime () time.Time {
@@ -58,6 +62,28 @@ func (c CbOperationLog) GetSessionID() string {
5862 return ""
5963}
6064
65+ func (c CbOperationLog ) GetUserName () string {
66+ if c .User != nil {
67+ return c .User .Name
68+ }
69+ return ""
70+ }
71+
72+ func (c CbOperationLog ) GetProjectName () string {
73+ if c .Project != nil {
74+ return c .Project .Name
75+ }
76+ return ""
77+ }
78+
79+ func (c CbOperationLog ) GetDbServiceName () string {
80+ if c .DbService != nil {
81+ return c .DbService .Name
82+ }
83+ return ""
84+
85+ }
86+
6187// ListCbOperationLogOption 用于查询操作日志的选项
6288type ListCbOperationLogOption struct {
6389 PageNumber uint32
0 commit comments