2020-10-10 11:49:21 +08:00
|
|
|
package models
|
2020-10-10 19:21:32 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
2024-07-27 14:15:25 +08:00
|
|
|
|
2020-10-10 19:21:32 +08:00
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
|
|
|
)
|
|
|
|
|
|
2021-06-02 11:53:24 +08:00
|
|
|
// ToPB 转换成PB对象
|
2020-10-10 19:21:32 +08:00
|
|
|
func (this *HTTPAccessLog) ToPB() (*pb.HTTPAccessLog, error) {
|
|
|
|
|
p := &pb.HTTPAccessLog{}
|
2022-03-22 19:30:30 +08:00
|
|
|
err := json.Unmarshal(this.Content, p)
|
2020-10-10 19:21:32 +08:00
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
p.RequestId = this.RequestId
|
2022-03-22 19:30:30 +08:00
|
|
|
p.RequestBody = this.RequestBody
|
2020-10-10 19:21:32 +08:00
|
|
|
return p, nil
|
|
|
|
|
}
|