package model import ( "crawler/config" "crawler/service" ) type ProcessLogInterface interface { Save() } type ProcessLogModel struct { ProcessLog } type ProcessLog struct { Path string `json:"path"` Code int `json:"code"` Method string `json:"method"` Response string `json:"response"` Request string `json:"request"` RawQuery string `json:"rawQuery"` CreatedAt string `json:"createdAt"` } func (this *ProcessLogModel) Save() { var ( db = service.DB_CRAWLER conn = db.SQLDB ) sql := ` INSERT INTO tb_process_log SET path = ?, code = ?, method = ?, response = ?, request = ?, raw_query = ?, created_at = NOW(); ` _, err := conn.Exec(sql, this.Path, this.Code, this.Method, this.Response, this.Request, this.RawQuery) if err != nil { db.SetErrorLog(err, sql) } db.SetGeneralLog(config.GL_ACTION_WRITE, sql, "insert process log") }