2418 lines
60 KiB
Go
2418 lines
60 KiB
Go
// Code generated by thriftgo (0.3.12). DO NOT EDIT.
|
|
|
|
package push
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config"
|
|
"github.com/apache/thrift/lib/go/thrift"
|
|
"strings"
|
|
)
|
|
|
|
type PushReq struct {
|
|
Id int64 `thrift:"id,1,required" frugal:"1,required,i64" form:"id,required" json:"id,required" query:"id,required"`
|
|
Title string `thrift:"title,2,required" frugal:"2,required,string" form:"title,required" json:"title,required" query:"title,required"`
|
|
Content string `thrift:"content,3,required" frugal:"3,required,string" form:"content,required" json:"content,required" query:"content,required"`
|
|
}
|
|
|
|
func NewPushReq() *PushReq {
|
|
return &PushReq{}
|
|
}
|
|
|
|
func (p *PushReq) InitDefault() {
|
|
*p = PushReq{}
|
|
}
|
|
|
|
func (p *PushReq) GetId() (v int64) {
|
|
return p.Id
|
|
}
|
|
|
|
func (p *PushReq) GetTitle() (v string) {
|
|
return p.Title
|
|
}
|
|
|
|
func (p *PushReq) GetContent() (v string) {
|
|
return p.Content
|
|
}
|
|
func (p *PushReq) SetId(val int64) {
|
|
p.Id = val
|
|
}
|
|
func (p *PushReq) SetTitle(val string) {
|
|
p.Title = val
|
|
}
|
|
func (p *PushReq) SetContent(val string) {
|
|
p.Content = val
|
|
}
|
|
|
|
var fieldIDToName_PushReq = map[int16]string{
|
|
1: "id",
|
|
2: "title",
|
|
3: "content",
|
|
}
|
|
|
|
func (p *PushReq) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
var issetId bool = false
|
|
var issetTitle bool = false
|
|
var issetContent bool = false
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 1:
|
|
if fieldTypeId == thrift.I64 {
|
|
if err = p.ReadField1(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
issetId = true
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 2:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField2(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
issetTitle = true
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 3:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField3(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
issetContent = true
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
if !issetId {
|
|
fieldId = 1
|
|
goto RequiredFieldNotSetError
|
|
}
|
|
|
|
if !issetTitle {
|
|
fieldId = 2
|
|
goto RequiredFieldNotSetError
|
|
}
|
|
|
|
if !issetContent {
|
|
fieldId = 3
|
|
goto RequiredFieldNotSetError
|
|
}
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PushReq[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
RequiredFieldNotSetError:
|
|
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_PushReq[fieldId]))
|
|
}
|
|
|
|
func (p *PushReq) ReadField1(iprot thrift.TProtocol) error {
|
|
|
|
var _field int64
|
|
if v, err := iprot.ReadI64(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Id = _field
|
|
return nil
|
|
}
|
|
func (p *PushReq) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Title = _field
|
|
return nil
|
|
}
|
|
func (p *PushReq) ReadField3(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Content = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PushReq) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("PushReq"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField1(oprot); err != nil {
|
|
fieldId = 1
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField2(oprot); err != nil {
|
|
fieldId = 2
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField3(oprot); err != nil {
|
|
fieldId = 3
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushReq) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("id", thrift.I64, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI64(p.Id); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushReq) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("title", thrift.STRING, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Title); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushReq) writeField3(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("content", thrift.STRING, 3); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Content); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushReq) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushReq(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushReq) DeepEqual(ano *PushReq) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Id) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.Title) {
|
|
return false
|
|
}
|
|
if !p.Field3DeepEqual(ano.Content) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PushReq) Field1DeepEqual(src int64) bool {
|
|
|
|
if p.Id != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PushReq) Field2DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Title, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PushReq) Field3DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Content, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PushResp struct {
|
|
ErrCode int64 `thrift:"errCode,1,required" frugal:"1,required,i64" form:"errCode,required" json:"errCode,required" query:"errCode,required"`
|
|
ErrMsg string `thrift:"errMsg,2" frugal:"2,default,string" form:"errMsg" json:"errMsg" query:"errMsg"`
|
|
MsgId string `thrift:"msgId,3" frugal:"3,default,string" form:"msgId" json:"msgId" query:"msgId"`
|
|
}
|
|
|
|
func NewPushResp() *PushResp {
|
|
return &PushResp{}
|
|
}
|
|
|
|
func (p *PushResp) InitDefault() {
|
|
*p = PushResp{}
|
|
}
|
|
|
|
func (p *PushResp) GetErrCode() (v int64) {
|
|
return p.ErrCode
|
|
}
|
|
|
|
func (p *PushResp) GetErrMsg() (v string) {
|
|
return p.ErrMsg
|
|
}
|
|
|
|
func (p *PushResp) GetMsgId() (v string) {
|
|
return p.MsgId
|
|
}
|
|
func (p *PushResp) SetErrCode(val int64) {
|
|
p.ErrCode = val
|
|
}
|
|
func (p *PushResp) SetErrMsg(val string) {
|
|
p.ErrMsg = val
|
|
}
|
|
func (p *PushResp) SetMsgId(val string) {
|
|
p.MsgId = val
|
|
}
|
|
|
|
var fieldIDToName_PushResp = map[int16]string{
|
|
1: "errCode",
|
|
2: "errMsg",
|
|
3: "msgId",
|
|
}
|
|
|
|
func (p *PushResp) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
var issetErrCode bool = false
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 1:
|
|
if fieldTypeId == thrift.I64 {
|
|
if err = p.ReadField1(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
issetErrCode = true
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 2:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField2(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 3:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField3(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
if !issetErrCode {
|
|
fieldId = 1
|
|
goto RequiredFieldNotSetError
|
|
}
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PushResp[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
RequiredFieldNotSetError:
|
|
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_PushResp[fieldId]))
|
|
}
|
|
|
|
func (p *PushResp) ReadField1(iprot thrift.TProtocol) error {
|
|
|
|
var _field int64
|
|
if v, err := iprot.ReadI64(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.ErrCode = _field
|
|
return nil
|
|
}
|
|
func (p *PushResp) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.ErrMsg = _field
|
|
return nil
|
|
}
|
|
func (p *PushResp) ReadField3(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.MsgId = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PushResp) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("PushResp"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField1(oprot); err != nil {
|
|
fieldId = 1
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField2(oprot); err != nil {
|
|
fieldId = 2
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField3(oprot); err != nil {
|
|
fieldId = 3
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushResp) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("errCode", thrift.I64, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI64(p.ErrCode); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushResp) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("errMsg", thrift.STRING, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.ErrMsg); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushResp) writeField3(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("msgId", thrift.STRING, 3); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.MsgId); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushResp) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushResp(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushResp) DeepEqual(ano *PushResp) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.ErrCode) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.ErrMsg) {
|
|
return false
|
|
}
|
|
if !p.Field3DeepEqual(ano.MsgId) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PushResp) Field1DeepEqual(src int64) bool {
|
|
|
|
if p.ErrCode != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PushResp) Field2DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.ErrMsg, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PushResp) Field3DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.MsgId, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type ListPusherRequest struct {
|
|
Keyword string `thrift:"keyword,1" frugal:"1,default,string" form:"keyword" json:"keyword" query:"keyword"`
|
|
Page int64 `thrift:"page,2,optional" frugal:"2,optional,i64" form:"page" json:"page,omitempty" query:"page"`
|
|
Size int16 `thrift:"size,3,optional" frugal:"3,optional,i16" form:"size" json:"size,omitempty" query:"size"`
|
|
All bool `thrift:"all,4" frugal:"4,default,bool" form:"all" json:"all" query:"all"`
|
|
}
|
|
|
|
func NewListPusherRequest() *ListPusherRequest {
|
|
return &ListPusherRequest{
|
|
|
|
Page: 10,
|
|
Size: 1,
|
|
}
|
|
}
|
|
|
|
func (p *ListPusherRequest) InitDefault() {
|
|
*p = ListPusherRequest{
|
|
|
|
Page: 10,
|
|
Size: 1,
|
|
}
|
|
}
|
|
|
|
func (p *ListPusherRequest) GetKeyword() (v string) {
|
|
return p.Keyword
|
|
}
|
|
|
|
var ListPusherRequest_Page_DEFAULT int64 = 10
|
|
|
|
func (p *ListPusherRequest) GetPage() (v int64) {
|
|
if !p.IsSetPage() {
|
|
return ListPusherRequest_Page_DEFAULT
|
|
}
|
|
return p.Page
|
|
}
|
|
|
|
var ListPusherRequest_Size_DEFAULT int16 = 1
|
|
|
|
func (p *ListPusherRequest) GetSize() (v int16) {
|
|
if !p.IsSetSize() {
|
|
return ListPusherRequest_Size_DEFAULT
|
|
}
|
|
return p.Size
|
|
}
|
|
|
|
func (p *ListPusherRequest) GetAll() (v bool) {
|
|
return p.All
|
|
}
|
|
func (p *ListPusherRequest) SetKeyword(val string) {
|
|
p.Keyword = val
|
|
}
|
|
func (p *ListPusherRequest) SetPage(val int64) {
|
|
p.Page = val
|
|
}
|
|
func (p *ListPusherRequest) SetSize(val int16) {
|
|
p.Size = val
|
|
}
|
|
func (p *ListPusherRequest) SetAll(val bool) {
|
|
p.All = val
|
|
}
|
|
|
|
var fieldIDToName_ListPusherRequest = map[int16]string{
|
|
1: "keyword",
|
|
2: "page",
|
|
3: "size",
|
|
4: "all",
|
|
}
|
|
|
|
func (p *ListPusherRequest) IsSetPage() bool {
|
|
return p.Page != ListPusherRequest_Page_DEFAULT
|
|
}
|
|
|
|
func (p *ListPusherRequest) IsSetSize() bool {
|
|
return p.Size != ListPusherRequest_Size_DEFAULT
|
|
}
|
|
|
|
func (p *ListPusherRequest) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 1:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField1(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 2:
|
|
if fieldTypeId == thrift.I64 {
|
|
if err = p.ReadField2(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 3:
|
|
if fieldTypeId == thrift.I16 {
|
|
if err = p.ReadField3(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 4:
|
|
if fieldTypeId == thrift.BOOL {
|
|
if err = p.ReadField4(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ListPusherRequest[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherRequest) ReadField1(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Keyword = _field
|
|
return nil
|
|
}
|
|
func (p *ListPusherRequest) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field int64
|
|
if v, err := iprot.ReadI64(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Page = _field
|
|
return nil
|
|
}
|
|
func (p *ListPusherRequest) ReadField3(iprot thrift.TProtocol) error {
|
|
|
|
var _field int16
|
|
if v, err := iprot.ReadI16(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Size = _field
|
|
return nil
|
|
}
|
|
func (p *ListPusherRequest) ReadField4(iprot thrift.TProtocol) error {
|
|
|
|
var _field bool
|
|
if v, err := iprot.ReadBool(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.All = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *ListPusherRequest) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("ListPusherRequest"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField1(oprot); err != nil {
|
|
fieldId = 1
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField2(oprot); err != nil {
|
|
fieldId = 2
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField3(oprot); err != nil {
|
|
fieldId = 3
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField4(oprot); err != nil {
|
|
fieldId = 4
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherRequest) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("keyword", thrift.STRING, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Keyword); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherRequest) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if p.IsSetPage() {
|
|
if err = oprot.WriteFieldBegin("page", thrift.I64, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI64(p.Page); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherRequest) writeField3(oprot thrift.TProtocol) (err error) {
|
|
if p.IsSetSize() {
|
|
if err = oprot.WriteFieldBegin("size", thrift.I16, 3); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI16(p.Size); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherRequest) writeField4(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("all", thrift.BOOL, 4); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteBool(p.All); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherRequest) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("ListPusherRequest(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *ListPusherRequest) DeepEqual(ano *ListPusherRequest) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Keyword) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.Page) {
|
|
return false
|
|
}
|
|
if !p.Field3DeepEqual(ano.Size) {
|
|
return false
|
|
}
|
|
if !p.Field4DeepEqual(ano.All) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *ListPusherRequest) Field1DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Keyword, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *ListPusherRequest) Field2DeepEqual(src int64) bool {
|
|
|
|
if p.Page != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *ListPusherRequest) Field3DeepEqual(src int16) bool {
|
|
|
|
if p.Size != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *ListPusherRequest) Field4DeepEqual(src bool) bool {
|
|
|
|
if p.All != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type ListPusherResponse struct {
|
|
Total int64 `thrift:"total,1" frugal:"1,default,i64" form:"total" json:"total" query:"total"`
|
|
List []*config.PushConfig `thrift:"list,2" frugal:"2,default,list<config.PushConfig>" form:"list" json:"list" query:"list"`
|
|
}
|
|
|
|
func NewListPusherResponse() *ListPusherResponse {
|
|
return &ListPusherResponse{}
|
|
}
|
|
|
|
func (p *ListPusherResponse) InitDefault() {
|
|
*p = ListPusherResponse{}
|
|
}
|
|
|
|
func (p *ListPusherResponse) GetTotal() (v int64) {
|
|
return p.Total
|
|
}
|
|
|
|
func (p *ListPusherResponse) GetList() (v []*config.PushConfig) {
|
|
return p.List
|
|
}
|
|
func (p *ListPusherResponse) SetTotal(val int64) {
|
|
p.Total = val
|
|
}
|
|
func (p *ListPusherResponse) SetList(val []*config.PushConfig) {
|
|
p.List = val
|
|
}
|
|
|
|
var fieldIDToName_ListPusherResponse = map[int16]string{
|
|
1: "total",
|
|
2: "list",
|
|
}
|
|
|
|
func (p *ListPusherResponse) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 1:
|
|
if fieldTypeId == thrift.I64 {
|
|
if err = p.ReadField1(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 2:
|
|
if fieldTypeId == thrift.LIST {
|
|
if err = p.ReadField2(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ListPusherResponse[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherResponse) ReadField1(iprot thrift.TProtocol) error {
|
|
|
|
var _field int64
|
|
if v, err := iprot.ReadI64(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Total = _field
|
|
return nil
|
|
}
|
|
func (p *ListPusherResponse) ReadField2(iprot thrift.TProtocol) error {
|
|
_, size, err := iprot.ReadListBegin()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_field := make([]*config.PushConfig, 0, size)
|
|
values := make([]config.PushConfig, size)
|
|
for i := 0; i < size; i++ {
|
|
_elem := &values[i]
|
|
|
|
if err := _elem.Read(iprot); err != nil {
|
|
return err
|
|
}
|
|
|
|
_field = append(_field, _elem)
|
|
}
|
|
if err := iprot.ReadListEnd(); err != nil {
|
|
return err
|
|
}
|
|
p.List = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *ListPusherResponse) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("ListPusherResponse"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField1(oprot); err != nil {
|
|
fieldId = 1
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField2(oprot); err != nil {
|
|
fieldId = 2
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherResponse) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("total", thrift.I64, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI64(p.Total); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherResponse) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("list", thrift.LIST, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.List)); err != nil {
|
|
return err
|
|
}
|
|
for _, v := range p.List {
|
|
if err := v.Write(oprot); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
if err := oprot.WriteListEnd(); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
|
}
|
|
|
|
func (p *ListPusherResponse) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("ListPusherResponse(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *ListPusherResponse) DeepEqual(ano *ListPusherResponse) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Total) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.List) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *ListPusherResponse) Field1DeepEqual(src int64) bool {
|
|
|
|
if p.Total != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *ListPusherResponse) Field2DeepEqual(src []*config.PushConfig) bool {
|
|
|
|
if len(p.List) != len(src) {
|
|
return false
|
|
}
|
|
for i, v := range p.List {
|
|
_src := src[i]
|
|
if !v.DeepEqual(_src) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PushService interface {
|
|
Push(ctx context.Context, req *PushReq) (r *PushResp, err error)
|
|
|
|
Add(ctx context.Context, req *config.PushConfig) (err error)
|
|
|
|
List(ctx context.Context, req *ListPusherRequest) (r *ListPusherResponse, err error)
|
|
}
|
|
|
|
type PushServiceClient struct {
|
|
c thrift.TClient
|
|
}
|
|
|
|
func NewPushServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *PushServiceClient {
|
|
return &PushServiceClient{
|
|
c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
|
|
}
|
|
}
|
|
|
|
func NewPushServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *PushServiceClient {
|
|
return &PushServiceClient{
|
|
c: thrift.NewTStandardClient(iprot, oprot),
|
|
}
|
|
}
|
|
|
|
func NewPushServiceClient(c thrift.TClient) *PushServiceClient {
|
|
return &PushServiceClient{
|
|
c: c,
|
|
}
|
|
}
|
|
|
|
func (p *PushServiceClient) Client_() thrift.TClient {
|
|
return p.c
|
|
}
|
|
|
|
func (p *PushServiceClient) Push(ctx context.Context, req *PushReq) (r *PushResp, err error) {
|
|
var _args PushServicePushArgs
|
|
_args.Req = req
|
|
var _result PushServicePushResult
|
|
if err = p.Client_().Call(ctx, "Push", &_args, &_result); err != nil {
|
|
return
|
|
}
|
|
return _result.GetSuccess(), nil
|
|
}
|
|
func (p *PushServiceClient) Add(ctx context.Context, req *config.PushConfig) (err error) {
|
|
var _args PushServiceAddArgs
|
|
_args.Req = req
|
|
var _result PushServiceAddResult
|
|
if err = p.Client_().Call(ctx, "Add", &_args, &_result); err != nil {
|
|
return
|
|
}
|
|
return nil
|
|
}
|
|
func (p *PushServiceClient) List(ctx context.Context, req *ListPusherRequest) (r *ListPusherResponse, err error) {
|
|
var _args PushServiceListArgs
|
|
_args.Req = req
|
|
var _result PushServiceListResult
|
|
if err = p.Client_().Call(ctx, "List", &_args, &_result); err != nil {
|
|
return
|
|
}
|
|
return _result.GetSuccess(), nil
|
|
}
|
|
|
|
type PushServiceProcessor struct {
|
|
processorMap map[string]thrift.TProcessorFunction
|
|
handler PushService
|
|
}
|
|
|
|
func (p *PushServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
|
|
p.processorMap[key] = processor
|
|
}
|
|
|
|
func (p *PushServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
|
|
processor, ok = p.processorMap[key]
|
|
return processor, ok
|
|
}
|
|
|
|
func (p *PushServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
|
|
return p.processorMap
|
|
}
|
|
|
|
func NewPushServiceProcessor(handler PushService) *PushServiceProcessor {
|
|
self := &PushServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
|
|
self.AddToProcessorMap("Push", &pushServiceProcessorPush{handler: handler})
|
|
self.AddToProcessorMap("Add", &pushServiceProcessorAdd{handler: handler})
|
|
self.AddToProcessorMap("List", &pushServiceProcessorList{handler: handler})
|
|
return self
|
|
}
|
|
func (p *PushServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
|
name, _, seqId, err := iprot.ReadMessageBegin()
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
if processor, ok := p.GetProcessorFunction(name); ok {
|
|
return processor.Process(ctx, seqId, iprot, oprot)
|
|
}
|
|
iprot.Skip(thrift.STRUCT)
|
|
iprot.ReadMessageEnd()
|
|
x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
|
|
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
|
|
x.Write(oprot)
|
|
oprot.WriteMessageEnd()
|
|
oprot.Flush(ctx)
|
|
return false, x
|
|
}
|
|
|
|
type pushServiceProcessorPush struct {
|
|
handler PushService
|
|
}
|
|
|
|
func (p *pushServiceProcessorPush) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
|
args := PushServicePushArgs{}
|
|
if err = args.Read(iprot); err != nil {
|
|
iprot.ReadMessageEnd()
|
|
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
|
oprot.WriteMessageBegin("Push", thrift.EXCEPTION, seqId)
|
|
x.Write(oprot)
|
|
oprot.WriteMessageEnd()
|
|
oprot.Flush(ctx)
|
|
return false, err
|
|
}
|
|
|
|
iprot.ReadMessageEnd()
|
|
var err2 error
|
|
result := PushServicePushResult{}
|
|
var retval *PushResp
|
|
if retval, err2 = p.handler.Push(ctx, args.Req); err2 != nil {
|
|
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Push: "+err2.Error())
|
|
oprot.WriteMessageBegin("Push", thrift.EXCEPTION, seqId)
|
|
x.Write(oprot)
|
|
oprot.WriteMessageEnd()
|
|
oprot.Flush(ctx)
|
|
return true, err2
|
|
} else {
|
|
result.Success = retval
|
|
}
|
|
if err2 = oprot.WriteMessageBegin("Push", thrift.REPLY, seqId); err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err != nil {
|
|
return
|
|
}
|
|
return true, err
|
|
}
|
|
|
|
type pushServiceProcessorAdd struct {
|
|
handler PushService
|
|
}
|
|
|
|
func (p *pushServiceProcessorAdd) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
|
args := PushServiceAddArgs{}
|
|
if err = args.Read(iprot); err != nil {
|
|
iprot.ReadMessageEnd()
|
|
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
|
oprot.WriteMessageBegin("Add", thrift.EXCEPTION, seqId)
|
|
x.Write(oprot)
|
|
oprot.WriteMessageEnd()
|
|
oprot.Flush(ctx)
|
|
return false, err
|
|
}
|
|
|
|
iprot.ReadMessageEnd()
|
|
var err2 error
|
|
result := PushServiceAddResult{}
|
|
if err2 = p.handler.Add(ctx, args.Req); err2 != nil {
|
|
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Add: "+err2.Error())
|
|
oprot.WriteMessageBegin("Add", thrift.EXCEPTION, seqId)
|
|
x.Write(oprot)
|
|
oprot.WriteMessageEnd()
|
|
oprot.Flush(ctx)
|
|
return true, err2
|
|
}
|
|
if err2 = oprot.WriteMessageBegin("Add", thrift.REPLY, seqId); err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err != nil {
|
|
return
|
|
}
|
|
return true, err
|
|
}
|
|
|
|
type pushServiceProcessorList struct {
|
|
handler PushService
|
|
}
|
|
|
|
func (p *pushServiceProcessorList) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
|
args := PushServiceListArgs{}
|
|
if err = args.Read(iprot); err != nil {
|
|
iprot.ReadMessageEnd()
|
|
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
|
oprot.WriteMessageBegin("List", thrift.EXCEPTION, seqId)
|
|
x.Write(oprot)
|
|
oprot.WriteMessageEnd()
|
|
oprot.Flush(ctx)
|
|
return false, err
|
|
}
|
|
|
|
iprot.ReadMessageEnd()
|
|
var err2 error
|
|
result := PushServiceListResult{}
|
|
var retval *ListPusherResponse
|
|
if retval, err2 = p.handler.List(ctx, args.Req); err2 != nil {
|
|
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing List: "+err2.Error())
|
|
oprot.WriteMessageBegin("List", thrift.EXCEPTION, seqId)
|
|
x.Write(oprot)
|
|
oprot.WriteMessageEnd()
|
|
oprot.Flush(ctx)
|
|
return true, err2
|
|
} else {
|
|
result.Success = retval
|
|
}
|
|
if err2 = oprot.WriteMessageBegin("List", thrift.REPLY, seqId); err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
|
err = err2
|
|
}
|
|
if err != nil {
|
|
return
|
|
}
|
|
return true, err
|
|
}
|
|
|
|
type PushServicePushArgs struct {
|
|
Req *PushReq `thrift:"req,1" frugal:"1,default,PushReq"`
|
|
}
|
|
|
|
func NewPushServicePushArgs() *PushServicePushArgs {
|
|
return &PushServicePushArgs{}
|
|
}
|
|
|
|
func (p *PushServicePushArgs) InitDefault() {
|
|
*p = PushServicePushArgs{}
|
|
}
|
|
|
|
var PushServicePushArgs_Req_DEFAULT *PushReq
|
|
|
|
func (p *PushServicePushArgs) GetReq() (v *PushReq) {
|
|
if !p.IsSetReq() {
|
|
return PushServicePushArgs_Req_DEFAULT
|
|
}
|
|
return p.Req
|
|
}
|
|
func (p *PushServicePushArgs) SetReq(val *PushReq) {
|
|
p.Req = val
|
|
}
|
|
|
|
var fieldIDToName_PushServicePushArgs = map[int16]string{
|
|
1: "req",
|
|
}
|
|
|
|
func (p *PushServicePushArgs) IsSetReq() bool {
|
|
return p.Req != nil
|
|
}
|
|
|
|
func (p *PushServicePushArgs) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 1:
|
|
if fieldTypeId == thrift.STRUCT {
|
|
if err = p.ReadField1(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PushServicePushArgs[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServicePushArgs) ReadField1(iprot thrift.TProtocol) error {
|
|
_field := NewPushReq()
|
|
if err := _field.Read(iprot); err != nil {
|
|
return err
|
|
}
|
|
p.Req = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PushServicePushArgs) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("Push_args"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField1(oprot); err != nil {
|
|
fieldId = 1
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServicePushArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := p.Req.Write(oprot); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServicePushArgs) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushServicePushArgs(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushServicePushArgs) DeepEqual(ano *PushServicePushArgs) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Req) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PushServicePushArgs) Field1DeepEqual(src *PushReq) bool {
|
|
|
|
if !p.Req.DeepEqual(src) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PushServicePushResult struct {
|
|
Success *PushResp `thrift:"success,0,optional" frugal:"0,optional,PushResp"`
|
|
}
|
|
|
|
func NewPushServicePushResult() *PushServicePushResult {
|
|
return &PushServicePushResult{}
|
|
}
|
|
|
|
func (p *PushServicePushResult) InitDefault() {
|
|
*p = PushServicePushResult{}
|
|
}
|
|
|
|
var PushServicePushResult_Success_DEFAULT *PushResp
|
|
|
|
func (p *PushServicePushResult) GetSuccess() (v *PushResp) {
|
|
if !p.IsSetSuccess() {
|
|
return PushServicePushResult_Success_DEFAULT
|
|
}
|
|
return p.Success
|
|
}
|
|
func (p *PushServicePushResult) SetSuccess(x interface{}) {
|
|
p.Success = x.(*PushResp)
|
|
}
|
|
|
|
var fieldIDToName_PushServicePushResult = map[int16]string{
|
|
0: "success",
|
|
}
|
|
|
|
func (p *PushServicePushResult) IsSetSuccess() bool {
|
|
return p.Success != nil
|
|
}
|
|
|
|
func (p *PushServicePushResult) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 0:
|
|
if fieldTypeId == thrift.STRUCT {
|
|
if err = p.ReadField0(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PushServicePushResult[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServicePushResult) ReadField0(iprot thrift.TProtocol) error {
|
|
_field := NewPushResp()
|
|
if err := _field.Read(iprot); err != nil {
|
|
return err
|
|
}
|
|
p.Success = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PushServicePushResult) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("Push_result"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField0(oprot); err != nil {
|
|
fieldId = 0
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServicePushResult) writeField0(oprot thrift.TProtocol) (err error) {
|
|
if p.IsSetSuccess() {
|
|
if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := p.Success.Write(oprot); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServicePushResult) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushServicePushResult(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushServicePushResult) DeepEqual(ano *PushServicePushResult) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field0DeepEqual(ano.Success) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PushServicePushResult) Field0DeepEqual(src *PushResp) bool {
|
|
|
|
if !p.Success.DeepEqual(src) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PushServiceAddArgs struct {
|
|
Req *config.PushConfig `thrift:"req,1" frugal:"1,default,config.PushConfig"`
|
|
}
|
|
|
|
func NewPushServiceAddArgs() *PushServiceAddArgs {
|
|
return &PushServiceAddArgs{}
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) InitDefault() {
|
|
*p = PushServiceAddArgs{}
|
|
}
|
|
|
|
var PushServiceAddArgs_Req_DEFAULT *config.PushConfig
|
|
|
|
func (p *PushServiceAddArgs) GetReq() (v *config.PushConfig) {
|
|
if !p.IsSetReq() {
|
|
return PushServiceAddArgs_Req_DEFAULT
|
|
}
|
|
return p.Req
|
|
}
|
|
func (p *PushServiceAddArgs) SetReq(val *config.PushConfig) {
|
|
p.Req = val
|
|
}
|
|
|
|
var fieldIDToName_PushServiceAddArgs = map[int16]string{
|
|
1: "req",
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) IsSetReq() bool {
|
|
return p.Req != nil
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 1:
|
|
if fieldTypeId == thrift.STRUCT {
|
|
if err = p.ReadField1(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PushServiceAddArgs[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) ReadField1(iprot thrift.TProtocol) error {
|
|
_field := config.NewPushConfig()
|
|
if err := _field.Read(iprot); err != nil {
|
|
return err
|
|
}
|
|
p.Req = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("Add_args"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField1(oprot); err != nil {
|
|
fieldId = 1
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := p.Req.Write(oprot); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushServiceAddArgs(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) DeepEqual(ano *PushServiceAddArgs) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Req) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PushServiceAddArgs) Field1DeepEqual(src *config.PushConfig) bool {
|
|
|
|
if !p.Req.DeepEqual(src) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PushServiceAddResult struct {
|
|
}
|
|
|
|
func NewPushServiceAddResult() *PushServiceAddResult {
|
|
return &PushServiceAddResult{}
|
|
}
|
|
|
|
func (p *PushServiceAddResult) InitDefault() {
|
|
*p = PushServiceAddResult{}
|
|
}
|
|
|
|
var fieldIDToName_PushServiceAddResult = map[int16]string{}
|
|
|
|
func (p *PushServiceAddResult) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldTypeError
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
SkipFieldTypeError:
|
|
return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceAddResult) Write(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteStructBegin("Add_result"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceAddResult) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushServiceAddResult(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushServiceAddResult) DeepEqual(ano *PushServiceAddResult) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PushServiceListArgs struct {
|
|
Req *ListPusherRequest `thrift:"req,1" frugal:"1,default,ListPusherRequest"`
|
|
}
|
|
|
|
func NewPushServiceListArgs() *PushServiceListArgs {
|
|
return &PushServiceListArgs{}
|
|
}
|
|
|
|
func (p *PushServiceListArgs) InitDefault() {
|
|
*p = PushServiceListArgs{}
|
|
}
|
|
|
|
var PushServiceListArgs_Req_DEFAULT *ListPusherRequest
|
|
|
|
func (p *PushServiceListArgs) GetReq() (v *ListPusherRequest) {
|
|
if !p.IsSetReq() {
|
|
return PushServiceListArgs_Req_DEFAULT
|
|
}
|
|
return p.Req
|
|
}
|
|
func (p *PushServiceListArgs) SetReq(val *ListPusherRequest) {
|
|
p.Req = val
|
|
}
|
|
|
|
var fieldIDToName_PushServiceListArgs = map[int16]string{
|
|
1: "req",
|
|
}
|
|
|
|
func (p *PushServiceListArgs) IsSetReq() bool {
|
|
return p.Req != nil
|
|
}
|
|
|
|
func (p *PushServiceListArgs) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 1:
|
|
if fieldTypeId == thrift.STRUCT {
|
|
if err = p.ReadField1(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PushServiceListArgs[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceListArgs) ReadField1(iprot thrift.TProtocol) error {
|
|
_field := NewListPusherRequest()
|
|
if err := _field.Read(iprot); err != nil {
|
|
return err
|
|
}
|
|
p.Req = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PushServiceListArgs) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("List_args"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField1(oprot); err != nil {
|
|
fieldId = 1
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceListArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := p.Req.Write(oprot); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceListArgs) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushServiceListArgs(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushServiceListArgs) DeepEqual(ano *PushServiceListArgs) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Req) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PushServiceListArgs) Field1DeepEqual(src *ListPusherRequest) bool {
|
|
|
|
if !p.Req.DeepEqual(src) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PushServiceListResult struct {
|
|
Success *ListPusherResponse `thrift:"success,0,optional" frugal:"0,optional,ListPusherResponse"`
|
|
}
|
|
|
|
func NewPushServiceListResult() *PushServiceListResult {
|
|
return &PushServiceListResult{}
|
|
}
|
|
|
|
func (p *PushServiceListResult) InitDefault() {
|
|
*p = PushServiceListResult{}
|
|
}
|
|
|
|
var PushServiceListResult_Success_DEFAULT *ListPusherResponse
|
|
|
|
func (p *PushServiceListResult) GetSuccess() (v *ListPusherResponse) {
|
|
if !p.IsSetSuccess() {
|
|
return PushServiceListResult_Success_DEFAULT
|
|
}
|
|
return p.Success
|
|
}
|
|
func (p *PushServiceListResult) SetSuccess(x interface{}) {
|
|
p.Success = x.(*ListPusherResponse)
|
|
}
|
|
|
|
var fieldIDToName_PushServiceListResult = map[int16]string{
|
|
0: "success",
|
|
}
|
|
|
|
func (p *PushServiceListResult) IsSetSuccess() bool {
|
|
return p.Success != nil
|
|
}
|
|
|
|
func (p *PushServiceListResult) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
|
|
if _, err = iprot.ReadStructBegin(); err != nil {
|
|
goto ReadStructBeginError
|
|
}
|
|
|
|
for {
|
|
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
|
if err != nil {
|
|
goto ReadFieldBeginError
|
|
}
|
|
if fieldTypeId == thrift.STOP {
|
|
break
|
|
}
|
|
|
|
switch fieldId {
|
|
case 0:
|
|
if fieldTypeId == thrift.STRUCT {
|
|
if err = p.ReadField0(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
default:
|
|
if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
}
|
|
if err = iprot.ReadFieldEnd(); err != nil {
|
|
goto ReadFieldEndError
|
|
}
|
|
}
|
|
if err = iprot.ReadStructEnd(); err != nil {
|
|
goto ReadStructEndError
|
|
}
|
|
|
|
return nil
|
|
ReadStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
|
ReadFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
|
ReadFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PushServiceListResult[fieldId]), err)
|
|
SkipFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
|
|
|
ReadFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
|
ReadStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceListResult) ReadField0(iprot thrift.TProtocol) error {
|
|
_field := NewListPusherResponse()
|
|
if err := _field.Read(iprot); err != nil {
|
|
return err
|
|
}
|
|
p.Success = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PushServiceListResult) Write(oprot thrift.TProtocol) (err error) {
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("List_result"); err != nil {
|
|
goto WriteStructBeginError
|
|
}
|
|
if p != nil {
|
|
if err = p.writeField0(oprot); err != nil {
|
|
fieldId = 0
|
|
goto WriteFieldError
|
|
}
|
|
}
|
|
if err = oprot.WriteFieldStop(); err != nil {
|
|
goto WriteFieldStopError
|
|
}
|
|
if err = oprot.WriteStructEnd(); err != nil {
|
|
goto WriteStructEndError
|
|
}
|
|
return nil
|
|
WriteStructBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
|
WriteFieldError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
|
WriteFieldStopError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
|
WriteStructEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceListResult) writeField0(oprot thrift.TProtocol) (err error) {
|
|
if p.IsSetSuccess() {
|
|
if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := p.Success.Write(oprot); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PushServiceListResult) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PushServiceListResult(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PushServiceListResult) DeepEqual(ano *PushServiceListResult) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field0DeepEqual(ano.Success) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PushServiceListResult) Field0DeepEqual(src *ListPusherResponse) bool {
|
|
|
|
if !p.Success.DeepEqual(src) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|