pusher/kitex_gen/config/config.go

469 lines
11 KiB
Go
Raw Normal View History

2024-05-17 18:02:10 +08:00
// Code generated by thriftgo (0.3.12). DO NOT EDIT.
package config
import (
"fmt"
"github.com/apache/thrift/lib/go/thrift"
"strings"
)
type PushConfig struct {
Id int64 `thrift:"id,1" frugal:"1,default,i64" form:"id" json:"id" query:"id"`
CreatedAt int64 `thrift:"createdAt,2" frugal:"2,default,i64" form:"createdAt" json:"createdAt" query:"createdAt"`
Type int8 `thrift:"type,3" frugal:"3,default,i8" form:"type" json:"type" query:"type"`
Name string `thrift:"name,4" frugal:"4,default,string" form:"name" json:"name" query:"name"`
Remark string `thrift:"remark,5" frugal:"5,default,string" form:"remark" json:"remark" query:"remark"`
Option string `thrift:"option,6" frugal:"6,default,string" form:"option" json:"option" query:"option"`
}
func NewPushConfig() *PushConfig {
return &PushConfig{}
}
func (p *PushConfig) InitDefault() {
*p = PushConfig{}
}
func (p *PushConfig) GetId() (v int64) {
return p.Id
}
func (p *PushConfig) GetCreatedAt() (v int64) {
return p.CreatedAt
}
func (p *PushConfig) GetType() (v int8) {
return p.Type
}
func (p *PushConfig) GetName() (v string) {
return p.Name
}
func (p *PushConfig) GetRemark() (v string) {
return p.Remark
}
func (p *PushConfig) GetOption() (v string) {
return p.Option
}
func (p *PushConfig) SetId(val int64) {
p.Id = val
}
func (p *PushConfig) SetCreatedAt(val int64) {
p.CreatedAt = val
}
func (p *PushConfig) SetType(val int8) {
p.Type = val
}
func (p *PushConfig) SetName(val string) {
p.Name = val
}
func (p *PushConfig) SetRemark(val string) {
p.Remark = val
}
func (p *PushConfig) SetOption(val string) {
p.Option = val
}
var fieldIDToName_PushConfig = map[int16]string{
1: "id",
2: "createdAt",
3: "type",
4: "name",
5: "remark",
6: "option",
}
func (p *PushConfig) 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.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.BYTE {
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.STRING {
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_PushConfig[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 *PushConfig) 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 *PushConfig) 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 *PushConfig) ReadField3(iprot thrift.TProtocol) error {
var _field int8
if v, err := iprot.ReadByte(); err != nil {
return err
} else {
_field = v
}
p.Type = _field
return nil
}
func (p *PushConfig) 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 *PushConfig) 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 *PushConfig) 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 *PushConfig) Write(oprot thrift.TProtocol) (err error) {
var fieldId int16
if err = oprot.WriteStructBegin("PushConfig"); 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 *PushConfig) 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 *PushConfig) 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 *PushConfig) writeField3(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("type", thrift.BYTE, 3); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteByte(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 *PushConfig) 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 *PushConfig) 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 *PushConfig) 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 *PushConfig) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("PushConfig(%+v)", *p)
}
func (p *PushConfig) DeepEqual(ano *PushConfig) 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 *PushConfig) Field1DeepEqual(src int64) bool {
if p.Id != src {
return false
}
return true
}
func (p *PushConfig) Field2DeepEqual(src int64) bool {
if p.CreatedAt != src {
return false
}
return true
}
func (p *PushConfig) Field3DeepEqual(src int8) bool {
if p.Type != src {
return false
}
return true
}
func (p *PushConfig) Field4DeepEqual(src string) bool {
if strings.Compare(p.Name, src) != 0 {
return false
}
return true
}
func (p *PushConfig) Field5DeepEqual(src string) bool {
if strings.Compare(p.Remark, src) != 0 {
return false
}
return true
}
func (p *PushConfig) Field6DeepEqual(src string) bool {
if strings.Compare(p.Option, src) != 0 {
return false
}
return true
}