implementl get user and database

Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
This commit is contained in:
zhuhuijun
2022-12-07 18:07:00 +08:00
parent add66245ba
commit af88bad075
166 changed files with 58325 additions and 102 deletions

34
pkg/model/result.go Normal file
View File

@@ -0,0 +1,34 @@
package model
import "encoding/json"
// MysqlQueryPiece 查询信息
type MysqlQueryPiece struct {
BaseQueryPiece
ClientHost string `json:"cip"`
ClientPort string `json:"cport"`
VisitUser string `json:"user"`
VisitDB string `json:"db"`
QuerySQL string `json:"sql"`
CostTimeInMS int64 `json:"cms"`
Message string `json:"message"`
}
// BaseQueryPiece 查询信息
type BaseQueryPiece struct {
ServerIP string `json:"sip"`
ServerPort string `json:"sport"`
CapturePacketRate float64 `json:"cpr"`
EventTime int64 `json:"bt"`
}
func (p MysqlQueryPiece) ToString() string {
bytes, err := json.Marshal(&p)
if err != nil {
return ""
}
return string(bytes)
}

10
pkg/model/session.go Normal file
View File

@@ -0,0 +1,10 @@
package model
type MysqlSession struct {
UserName string
DBName string
ClientIP string
ClientPort string
ServerIP string
ServerPort string
}