package handle import "encoding/json" type WorkNotice struct { Prefix string `json:"prefix"` Data interface{} `json:"data"` Message string `json:"message"` } func (this *WorkNotice) ToBytes() []byte { out, _ := json.Marshal(this) return out } func NewWorkNotice(msg string, data interface{}) *WorkNotice { return &WorkNotice{ Prefix: "work", Message: msg, Data: data, } }