mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
35 lines
750 B
Go
35 lines
750 B
Go
package entity
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/crawlab-team/crawlab/core/interfaces"
|
|
"github.com/crawlab-team/go-trace"
|
|
)
|
|
|
|
type GrpcDelegateMessage struct {
|
|
ModelId interfaces.ModelId `json:"id"`
|
|
Method interfaces.ModelDelegateMethod `json:"m"`
|
|
Data []byte `json:"d"`
|
|
}
|
|
|
|
func (msg *GrpcDelegateMessage) GetModelId() interfaces.ModelId {
|
|
return msg.ModelId
|
|
}
|
|
|
|
func (msg *GrpcDelegateMessage) GetMethod() interfaces.ModelDelegateMethod {
|
|
return msg.Method
|
|
}
|
|
|
|
func (msg *GrpcDelegateMessage) GetData() []byte {
|
|
return msg.Data
|
|
}
|
|
|
|
func (msg *GrpcDelegateMessage) ToBytes() (data []byte) {
|
|
data, err := json.Marshal(*msg)
|
|
if err != nil {
|
|
_ = trace.TraceError(err)
|
|
return data
|
|
}
|
|
return data
|
|
}
|