add response parse module

This commit is contained in:
hebo
2019-12-24 22:39:30 +08:00
parent 0ed1b77305
commit 6c2fcd13b2
6 changed files with 141 additions and 18 deletions

View File

@@ -16,6 +16,8 @@ type MysqlQueryPiece struct {
VisitDB *string `json:"db"`
QuerySQL *string `json:"sql"`
CostTimeInMS int64 `json:"cms"`
OK int64 `json:"ok"`
ResponseVal int64 `json:"rv"`
}
func (mqp *MysqlQueryPiece) String() (*string) {
@@ -42,3 +44,8 @@ func (mqp *MysqlQueryPiece) GenerateJsonBytes() {
func (mqp *MysqlQueryPiece) GetSQL() (str *string) {
return mqp.QuerySQL
}
func (mqp *MysqlQueryPiece) SetResponse(ok, respVal int64) {
mqp.OK = ok
mqp.ResponseVal = respVal
}

View File

@@ -14,6 +14,7 @@ type QueryPiece interface {
GetSQL() *string
NeedSyncSend() bool
Recovery()
SetResponse(int64, int64)
}
// BaseQueryPiece 查询信息
@@ -80,6 +81,9 @@ func (bqp *BaseQueryPiece) GetSQL() (*string) {
func (bqp *BaseQueryPiece) Recovery() {
}
func (bqp *BaseQueryPiece) SetResponse(ok, respVal int64) {
}
/**
func marsharQueryPieceShareMemory(qp interface{}, cacheBuffer []byte) []byte {
buffer := bytes.NewBuffer(cacheBuffer)

View File

@@ -29,6 +29,8 @@ func NewPooledMysqlQueryPiece(
pmqp.EventTime = stmtBeginTime
pmqp.CostTimeInMS = nowInMS - stmtBeginTime
pmqp.recoverPool = mqpp
pmqp.OK = 0
pmqp.ResponseVal = -1
return
}