release 0.1.3-beta (#19)

Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
Li4n0
2021-05-25 20:41:37 +08:00
committed by GitHub
co-authored by E99p1ant
parent 1144f67d37
commit cbbf3ba0ba
68 changed files with 640 additions and 197 deletions
+6 -1
View File
@@ -17,6 +17,7 @@ type Record struct {
record.BaseRecord
Username string `gorm:"index" form:"username" json:"username" notice:"username"`
ClientName string `gorm:"index" form:"client_name" json:"client_name" notice:"client_name"`
Schema string `gorm:"index" form:"schema" json:"schema" notice:"schema"`
ClientOS string `gorm:"index" form:"client_os" json:"client_os" notice:"client_os"`
LoadLocalData bool `gorm:"index" form:"load_local_data" json:"load_local_data" notice:"load_local_data"`
Files []file.MySQLFile `form:"-" json:"files" notice:"-"`
@@ -31,7 +32,7 @@ func (r Record) Notice() {
notice.Notice(r)
}
func newRecord(rule *Rule, flag, username, clientName, clientOS, remoteIp, ipArea string, supportLoadLocalData bool, files []file.MySQLFile) (r *Record, err error) {
func newRecord(rule *Rule, flag, username, schema, clientName, clientOS, remoteIp, ipArea string, supportLoadLocalData bool, files []file.MySQLFile) (r *Record, err error) {
r = &Record{
BaseRecord: record.BaseRecord{
Flag: flag,
@@ -40,6 +41,7 @@ func newRecord(rule *Rule, flag, username, clientName, clientOS, remoteIp, ipAre
RequestTime: time.Now(),
},
Username: username,
Schema: schema,
ClientName: clientName,
ClientOS: clientOS,
LoadLocalData: supportLoadLocalData,
@@ -90,6 +92,9 @@ func ListRecords(c *gin.Context) {
if mysqlRecord.ClientName != "" {
db.Where("client_name like ?", "%"+mysqlRecord.ClientName)
}
if mysqlRecord.Schema != "" {
db.Where("schema like ?", "%"+mysqlRecord.Schema)
}
if c.Query("load_local_data") != "" {
if c.Query("load_local_data") == "true" {
db.Where("load_local_data = ?", true)