1800 lines
43 KiB
Go
1800 lines
43 KiB
Go
// Code generated by thriftgo (0.3.18). DO NOT EDIT.
|
|
|
|
package config
|
|
|
|
import (
|
|
"database/sql"
|
|
"database/sql/driver"
|
|
"fmt"
|
|
"github.com/apache/thrift/lib/go/thrift"
|
|
"strings"
|
|
)
|
|
|
|
type PusherConfigType int64
|
|
|
|
const (
|
|
PusherConfigType_AnPush PusherConfigType = 1
|
|
PusherConfigType_Email PusherConfigType = 2
|
|
)
|
|
|
|
func (p PusherConfigType) String() string {
|
|
switch p {
|
|
case PusherConfigType_AnPush:
|
|
return "AnPush"
|
|
case PusherConfigType_Email:
|
|
return "Email"
|
|
}
|
|
return "<UNSET>"
|
|
}
|
|
|
|
func PusherConfigTypeFromString(s string) (PusherConfigType, error) {
|
|
switch s {
|
|
case "AnPush":
|
|
return PusherConfigType_AnPush, nil
|
|
case "Email":
|
|
return PusherConfigType_Email, nil
|
|
}
|
|
return PusherConfigType(0), fmt.Errorf("not a valid PusherConfigType string")
|
|
}
|
|
|
|
func PusherConfigTypePtr(v PusherConfigType) *PusherConfigType { return &v }
|
|
func (p *PusherConfigType) Scan(value interface{}) (err error) {
|
|
var result sql.NullInt64
|
|
err = result.Scan(value)
|
|
*p = PusherConfigType(result.Int64)
|
|
return
|
|
}
|
|
|
|
func (p *PusherConfigType) Value() (driver.Value, error) {
|
|
if p == nil {
|
|
return nil, nil
|
|
}
|
|
return int64(*p), nil
|
|
}
|
|
|
|
type PusherConfig struct {
|
|
Id int64 `thrift:"id,1" frugal:"1,default,i64" json:"id"`
|
|
CreatedAt int64 `thrift:"createdAt,2" frugal:"2,default,i64" json:"createdAt"`
|
|
Type PusherConfigType `thrift:"type,3" frugal:"3,default,PusherConfigType" json:"type"`
|
|
Name string `thrift:"name,4,required" frugal:"4,required,string" json:"name"`
|
|
Remark string `thrift:"remark,5" frugal:"5,default,string" json:"remark"`
|
|
Option string `thrift:"option,6,required" frugal:"6,required,string" json:"option"`
|
|
}
|
|
|
|
func NewPusherConfig() *PusherConfig {
|
|
return &PusherConfig{}
|
|
}
|
|
|
|
func (p *PusherConfig) InitDefault() {
|
|
}
|
|
|
|
func (p *PusherConfig) GetId() (v int64) {
|
|
return p.Id
|
|
}
|
|
|
|
func (p *PusherConfig) GetCreatedAt() (v int64) {
|
|
return p.CreatedAt
|
|
}
|
|
|
|
func (p *PusherConfig) GetType() (v PusherConfigType) {
|
|
return p.Type
|
|
}
|
|
|
|
func (p *PusherConfig) GetName() (v string) {
|
|
return p.Name
|
|
}
|
|
|
|
func (p *PusherConfig) GetRemark() (v string) {
|
|
return p.Remark
|
|
}
|
|
|
|
func (p *PusherConfig) GetOption() (v string) {
|
|
return p.Option
|
|
}
|
|
func (p *PusherConfig) SetId(val int64) {
|
|
p.Id = val
|
|
}
|
|
func (p *PusherConfig) SetCreatedAt(val int64) {
|
|
p.CreatedAt = val
|
|
}
|
|
func (p *PusherConfig) SetType(val PusherConfigType) {
|
|
p.Type = val
|
|
}
|
|
func (p *PusherConfig) SetName(val string) {
|
|
p.Name = val
|
|
}
|
|
func (p *PusherConfig) SetRemark(val string) {
|
|
p.Remark = val
|
|
}
|
|
func (p *PusherConfig) SetOption(val string) {
|
|
p.Option = val
|
|
}
|
|
|
|
var fieldIDToName_PusherConfig = map[int16]string{
|
|
1: "id",
|
|
2: "createdAt",
|
|
3: "type",
|
|
4: "name",
|
|
5: "remark",
|
|
6: "option",
|
|
}
|
|
|
|
func (p *PusherConfig) Read(iprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldTypeId thrift.TType
|
|
var fieldId int16
|
|
var issetName bool = false
|
|
var issetOption 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
|
|
}
|
|
} 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.I32 {
|
|
if err = p.ReadField3(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 4:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField4(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
issetName = true
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 5:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField5(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 6:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField6(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
issetOption = 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 !issetName {
|
|
fieldId = 4
|
|
goto RequiredFieldNotSetError
|
|
}
|
|
|
|
if !issetOption {
|
|
fieldId = 6
|
|
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_PusherConfig[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_PusherConfig[fieldId]))
|
|
}
|
|
|
|
func (p *PusherConfig) 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 *PusherConfig) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field int64
|
|
if v, err := iprot.ReadI64(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.CreatedAt = _field
|
|
return nil
|
|
}
|
|
func (p *PusherConfig) ReadField3(iprot thrift.TProtocol) error {
|
|
|
|
var _field PusherConfigType
|
|
if v, err := iprot.ReadI32(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = PusherConfigType(v)
|
|
}
|
|
p.Type = _field
|
|
return nil
|
|
}
|
|
func (p *PusherConfig) ReadField4(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Name = _field
|
|
return nil
|
|
}
|
|
func (p *PusherConfig) ReadField5(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Remark = _field
|
|
return nil
|
|
}
|
|
func (p *PusherConfig) ReadField6(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Option = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PusherConfig) Write(oprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("PusherConfig"); 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 = p.writeField5(oprot); err != nil {
|
|
fieldId = 5
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField6(oprot); err != nil {
|
|
fieldId = 6
|
|
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 *PusherConfig) 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 *PusherConfig) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("createdAt", thrift.I64, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI64(p.CreatedAt); 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 *PusherConfig) writeField3(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("type", thrift.I32, 3); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI32(int32(p.Type)); 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 *PusherConfig) writeField4(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("name", thrift.STRING, 4); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Name); 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 *PusherConfig) writeField5(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("remark", thrift.STRING, 5); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Remark); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PusherConfig) writeField6(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("option", thrift.STRING, 6); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Option); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PusherConfig) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PusherConfig(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PusherConfig) DeepEqual(ano *PusherConfig) 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.CreatedAt) {
|
|
return false
|
|
}
|
|
if !p.Field3DeepEqual(ano.Type) {
|
|
return false
|
|
}
|
|
if !p.Field4DeepEqual(ano.Name) {
|
|
return false
|
|
}
|
|
if !p.Field5DeepEqual(ano.Remark) {
|
|
return false
|
|
}
|
|
if !p.Field6DeepEqual(ano.Option) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PusherConfig) Field1DeepEqual(src int64) bool {
|
|
|
|
if p.Id != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PusherConfig) Field2DeepEqual(src int64) bool {
|
|
|
|
if p.CreatedAt != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PusherConfig) Field3DeepEqual(src PusherConfigType) bool {
|
|
|
|
if p.Type != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PusherConfig) Field4DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Name, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PusherConfig) Field5DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Remark, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PusherConfig) Field6DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Option, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type PusherOption struct {
|
|
Title string `thrift:"title,1" frugal:"1,default,string" json:"title"`
|
|
Type PusherConfigType `thrift:"type,2" frugal:"2,default,PusherConfigType" json:"type"`
|
|
FormItems []*FormItem `thrift:"formItems,3" frugal:"3,default,list<FormItem>" json:"formItems"`
|
|
}
|
|
|
|
func NewPusherOption() *PusherOption {
|
|
return &PusherOption{}
|
|
}
|
|
|
|
func (p *PusherOption) InitDefault() {
|
|
}
|
|
|
|
func (p *PusherOption) GetTitle() (v string) {
|
|
return p.Title
|
|
}
|
|
|
|
func (p *PusherOption) GetType() (v PusherConfigType) {
|
|
return p.Type
|
|
}
|
|
|
|
func (p *PusherOption) GetFormItems() (v []*FormItem) {
|
|
return p.FormItems
|
|
}
|
|
func (p *PusherOption) SetTitle(val string) {
|
|
p.Title = val
|
|
}
|
|
func (p *PusherOption) SetType(val PusherConfigType) {
|
|
p.Type = val
|
|
}
|
|
func (p *PusherOption) SetFormItems(val []*FormItem) {
|
|
p.FormItems = val
|
|
}
|
|
|
|
var fieldIDToName_PusherOption = map[int16]string{
|
|
1: "title",
|
|
2: "type",
|
|
3: "formItems",
|
|
}
|
|
|
|
func (p *PusherOption) 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.I32 {
|
|
if err = p.ReadField2(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 3:
|
|
if fieldTypeId == thrift.LIST {
|
|
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
|
|
}
|
|
|
|
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_PusherOption[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 *PusherOption) ReadField1(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 *PusherOption) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field PusherConfigType
|
|
if v, err := iprot.ReadI32(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = PusherConfigType(v)
|
|
}
|
|
p.Type = _field
|
|
return nil
|
|
}
|
|
func (p *PusherOption) ReadField3(iprot thrift.TProtocol) error {
|
|
_, size, err := iprot.ReadListBegin()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_field := make([]*FormItem, 0, size)
|
|
values := make([]FormItem, size)
|
|
for i := 0; i < size; i++ {
|
|
_elem := &values[i]
|
|
_elem.InitDefault()
|
|
|
|
if err := _elem.Read(iprot); err != nil {
|
|
return err
|
|
}
|
|
|
|
_field = append(_field, _elem)
|
|
}
|
|
if err := iprot.ReadListEnd(); err != nil {
|
|
return err
|
|
}
|
|
p.FormItems = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *PusherOption) Write(oprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("PusherOption"); 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 *PusherOption) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("title", thrift.STRING, 1); 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 1 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PusherOption) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("type", thrift.I32, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI32(int32(p.Type)); 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 *PusherOption) writeField3(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("formItems", thrift.LIST, 3); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.FormItems)); err != nil {
|
|
return err
|
|
}
|
|
for _, v := range p.FormItems {
|
|
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 3 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
|
}
|
|
|
|
func (p *PusherOption) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("PusherOption(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *PusherOption) DeepEqual(ano *PusherOption) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Title) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.Type) {
|
|
return false
|
|
}
|
|
if !p.Field3DeepEqual(ano.FormItems) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *PusherOption) Field1DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Title, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PusherOption) Field2DeepEqual(src PusherConfigType) bool {
|
|
|
|
if p.Type != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *PusherOption) Field3DeepEqual(src []*FormItem) bool {
|
|
|
|
if len(p.FormItems) != len(src) {
|
|
return false
|
|
}
|
|
for i, v := range p.FormItems {
|
|
_src := src[i]
|
|
if !v.DeepEqual(_src) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
type FormItem struct {
|
|
Param string `thrift:"param,1" frugal:"1,default,string" json:"param"`
|
|
Type string `thrift:"type,2" frugal:"2,default,string" json:"type"`
|
|
Require bool `thrift:"require,3" frugal:"3,default,bool" json:"require"`
|
|
}
|
|
|
|
func NewFormItem() *FormItem {
|
|
return &FormItem{}
|
|
}
|
|
|
|
func (p *FormItem) InitDefault() {
|
|
}
|
|
|
|
func (p *FormItem) GetParam() (v string) {
|
|
return p.Param
|
|
}
|
|
|
|
func (p *FormItem) GetType() (v string) {
|
|
return p.Type
|
|
}
|
|
|
|
func (p *FormItem) GetRequire() (v bool) {
|
|
return p.Require
|
|
}
|
|
func (p *FormItem) SetParam(val string) {
|
|
p.Param = val
|
|
}
|
|
func (p *FormItem) SetType(val string) {
|
|
p.Type = val
|
|
}
|
|
func (p *FormItem) SetRequire(val bool) {
|
|
p.Require = val
|
|
}
|
|
|
|
var fieldIDToName_FormItem = map[int16]string{
|
|
1: "param",
|
|
2: "type",
|
|
3: "require",
|
|
}
|
|
|
|
func (p *FormItem) 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.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.BOOL {
|
|
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
|
|
}
|
|
|
|
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_FormItem[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 *FormItem) ReadField1(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Param = _field
|
|
return nil
|
|
}
|
|
func (p *FormItem) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Type = _field
|
|
return nil
|
|
}
|
|
func (p *FormItem) ReadField3(iprot thrift.TProtocol) error {
|
|
|
|
var _field bool
|
|
if v, err := iprot.ReadBool(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Require = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *FormItem) Write(oprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("FormItem"); 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 *FormItem) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("param", thrift.STRING, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Param); 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 *FormItem) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("type", thrift.STRING, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Type); 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 *FormItem) writeField3(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("require", thrift.BOOL, 3); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteBool(p.Require); 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 *FormItem) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("FormItem(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *FormItem) DeepEqual(ano *FormItem) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Param) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.Type) {
|
|
return false
|
|
}
|
|
if !p.Field3DeepEqual(ano.Require) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *FormItem) Field1DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Param, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *FormItem) Field2DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Type, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *FormItem) Field3DeepEqual(src bool) bool {
|
|
|
|
if p.Require != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type AnPush struct {
|
|
Token string `thrift:"token,1" frugal:"1,default,string" json:"token"`
|
|
Channel string `thrift:"channel,2" frugal:"2,default,string" json:"channel"`
|
|
}
|
|
|
|
func NewAnPush() *AnPush {
|
|
return &AnPush{}
|
|
}
|
|
|
|
func (p *AnPush) InitDefault() {
|
|
}
|
|
|
|
func (p *AnPush) GetToken() (v string) {
|
|
return p.Token
|
|
}
|
|
|
|
func (p *AnPush) GetChannel() (v string) {
|
|
return p.Channel
|
|
}
|
|
func (p *AnPush) SetToken(val string) {
|
|
p.Token = val
|
|
}
|
|
func (p *AnPush) SetChannel(val string) {
|
|
p.Channel = val
|
|
}
|
|
|
|
var fieldIDToName_AnPush = map[int16]string{
|
|
1: "token",
|
|
2: "channel",
|
|
}
|
|
|
|
func (p *AnPush) 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.STRING {
|
|
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_AnPush[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 *AnPush) ReadField1(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Token = _field
|
|
return nil
|
|
}
|
|
func (p *AnPush) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Channel = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *AnPush) Write(oprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("AnPush"); 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 *AnPush) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("token", thrift.STRING, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Token); 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 *AnPush) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("channel", thrift.STRING, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Channel); 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 *AnPush) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("AnPush(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *AnPush) DeepEqual(ano *AnPush) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.Token) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.Channel) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *AnPush) Field1DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Token, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *AnPush) Field2DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Channel, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
type EmailPush struct {
|
|
From string `thrift:"from,1" frugal:"1,default,string" json:"from"`
|
|
To string `thrift:"to,2" frugal:"2,default,string" json:"to"`
|
|
Username string `thrift:"username,3" frugal:"3,default,string" json:"username"`
|
|
Password string `thrift:"password,4" frugal:"4,default,string" json:"password"`
|
|
Host string `thrift:"host,5" frugal:"5,default,string" json:"host"`
|
|
Port int32 `thrift:"port,6" frugal:"6,default,i32" json:"port"`
|
|
}
|
|
|
|
func NewEmailPush() *EmailPush {
|
|
return &EmailPush{}
|
|
}
|
|
|
|
func (p *EmailPush) InitDefault() {
|
|
}
|
|
|
|
func (p *EmailPush) GetFrom() (v string) {
|
|
return p.From
|
|
}
|
|
|
|
func (p *EmailPush) GetTo() (v string) {
|
|
return p.To
|
|
}
|
|
|
|
func (p *EmailPush) GetUsername() (v string) {
|
|
return p.Username
|
|
}
|
|
|
|
func (p *EmailPush) GetPassword() (v string) {
|
|
return p.Password
|
|
}
|
|
|
|
func (p *EmailPush) GetHost() (v string) {
|
|
return p.Host
|
|
}
|
|
|
|
func (p *EmailPush) GetPort() (v int32) {
|
|
return p.Port
|
|
}
|
|
func (p *EmailPush) SetFrom(val string) {
|
|
p.From = val
|
|
}
|
|
func (p *EmailPush) SetTo(val string) {
|
|
p.To = val
|
|
}
|
|
func (p *EmailPush) SetUsername(val string) {
|
|
p.Username = val
|
|
}
|
|
func (p *EmailPush) SetPassword(val string) {
|
|
p.Password = val
|
|
}
|
|
func (p *EmailPush) SetHost(val string) {
|
|
p.Host = val
|
|
}
|
|
func (p *EmailPush) SetPort(val int32) {
|
|
p.Port = val
|
|
}
|
|
|
|
var fieldIDToName_EmailPush = map[int16]string{
|
|
1: "from",
|
|
2: "to",
|
|
3: "username",
|
|
4: "password",
|
|
5: "host",
|
|
6: "port",
|
|
}
|
|
|
|
func (p *EmailPush) 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.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
|
|
}
|
|
case 4:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField4(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 5:
|
|
if fieldTypeId == thrift.STRING {
|
|
if err = p.ReadField5(iprot); err != nil {
|
|
goto ReadFieldError
|
|
}
|
|
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
|
goto SkipFieldError
|
|
}
|
|
case 6:
|
|
if fieldTypeId == thrift.I32 {
|
|
if err = p.ReadField6(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_EmailPush[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 *EmailPush) ReadField1(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.From = _field
|
|
return nil
|
|
}
|
|
func (p *EmailPush) ReadField2(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.To = _field
|
|
return nil
|
|
}
|
|
func (p *EmailPush) ReadField3(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Username = _field
|
|
return nil
|
|
}
|
|
func (p *EmailPush) ReadField4(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Password = _field
|
|
return nil
|
|
}
|
|
func (p *EmailPush) ReadField5(iprot thrift.TProtocol) error {
|
|
|
|
var _field string
|
|
if v, err := iprot.ReadString(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Host = _field
|
|
return nil
|
|
}
|
|
func (p *EmailPush) ReadField6(iprot thrift.TProtocol) error {
|
|
|
|
var _field int32
|
|
if v, err := iprot.ReadI32(); err != nil {
|
|
return err
|
|
} else {
|
|
_field = v
|
|
}
|
|
p.Port = _field
|
|
return nil
|
|
}
|
|
|
|
func (p *EmailPush) Write(oprot thrift.TProtocol) (err error) {
|
|
|
|
var fieldId int16
|
|
if err = oprot.WriteStructBegin("EmailPush"); 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 = p.writeField5(oprot); err != nil {
|
|
fieldId = 5
|
|
goto WriteFieldError
|
|
}
|
|
if err = p.writeField6(oprot); err != nil {
|
|
fieldId = 6
|
|
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 *EmailPush) writeField1(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("from", thrift.STRING, 1); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.From); 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 *EmailPush) writeField2(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("to", thrift.STRING, 2); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.To); 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 *EmailPush) writeField3(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("username", thrift.STRING, 3); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Username); 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 *EmailPush) writeField4(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("password", thrift.STRING, 4); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Password); 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 *EmailPush) writeField5(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("host", thrift.STRING, 5); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteString(p.Host); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
|
}
|
|
|
|
func (p *EmailPush) writeField6(oprot thrift.TProtocol) (err error) {
|
|
if err = oprot.WriteFieldBegin("port", thrift.I32, 6); err != nil {
|
|
goto WriteFieldBeginError
|
|
}
|
|
if err := oprot.WriteI32(p.Port); err != nil {
|
|
return err
|
|
}
|
|
if err = oprot.WriteFieldEnd(); err != nil {
|
|
goto WriteFieldEndError
|
|
}
|
|
return nil
|
|
WriteFieldBeginError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
|
WriteFieldEndError:
|
|
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
|
}
|
|
|
|
func (p *EmailPush) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
return fmt.Sprintf("EmailPush(%+v)", *p)
|
|
|
|
}
|
|
|
|
func (p *EmailPush) DeepEqual(ano *EmailPush) bool {
|
|
if p == ano {
|
|
return true
|
|
} else if p == nil || ano == nil {
|
|
return false
|
|
}
|
|
if !p.Field1DeepEqual(ano.From) {
|
|
return false
|
|
}
|
|
if !p.Field2DeepEqual(ano.To) {
|
|
return false
|
|
}
|
|
if !p.Field3DeepEqual(ano.Username) {
|
|
return false
|
|
}
|
|
if !p.Field4DeepEqual(ano.Password) {
|
|
return false
|
|
}
|
|
if !p.Field5DeepEqual(ano.Host) {
|
|
return false
|
|
}
|
|
if !p.Field6DeepEqual(ano.Port) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (p *EmailPush) Field1DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.From, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *EmailPush) Field2DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.To, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *EmailPush) Field3DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Username, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *EmailPush) Field4DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Password, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *EmailPush) Field5DeepEqual(src string) bool {
|
|
|
|
if strings.Compare(p.Host, src) != 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
func (p *EmailPush) Field6DeepEqual(src int32) bool {
|
|
|
|
if p.Port != src {
|
|
return false
|
|
}
|
|
return true
|
|
}
|