// Code generated by Kitex v0.9.1. DO NOT EDIT. package config import ( "bytes" "fmt" "reflect" "strings" "github.com/apache/thrift/lib/go/thrift" "github.com/cloudwego/kitex/pkg/protocol/bthrift" ) // unused protection var ( _ = fmt.Formatter(nil) _ = (*bytes.Buffer)(nil) _ = (*strings.Builder)(nil) _ = reflect.Type(nil) _ = thrift.TProtocol(nil) _ = bthrift.BinaryWriter(nil) ) func (p *PusherConfig) FastRead(buf []byte) (int, error) { var err error var offset int var l int var fieldTypeId thrift.TType var fieldId int16 var issetName bool = false var issetOption bool = false _, l, err = bthrift.Binary.ReadStructBegin(buf) offset += l if err != nil { goto ReadStructBeginError } for { _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) offset += l if err != nil { goto ReadFieldBeginError } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if fieldTypeId == thrift.I64 { l, err = p.FastReadField1(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 2: if fieldTypeId == thrift.I64 { l, err = p.FastReadField2(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 3: if fieldTypeId == thrift.I32 { l, err = p.FastReadField3(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 4: if fieldTypeId == thrift.STRING { l, err = p.FastReadField4(buf[offset:]) offset += l if err != nil { goto ReadFieldError } issetName = true } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 5: if fieldTypeId == thrift.STRING { l, err = p.FastReadField5(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 6: if fieldTypeId == thrift.STRING { l, err = p.FastReadField6(buf[offset:]) offset += l if err != nil { goto ReadFieldError } issetOption = true } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } default: l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) offset += l if err != nil { goto ReadFieldEndError } } l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) offset += l if err != nil { goto ReadStructEndError } if !issetName { fieldId = 4 goto RequiredFieldNotSetError } if !issetOption { fieldId = 6 goto RequiredFieldNotSetError } return offset, nil ReadStructBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PusherConfig[fieldId]), err) SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) ReadFieldEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) RequiredFieldNotSetError: return offset, thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_PusherConfig[fieldId])) } func (p *PusherConfig) FastReadField1(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { return offset, err } else { offset += l p.Id = v } return offset, nil } func (p *PusherConfig) FastReadField2(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { return offset, err } else { offset += l p.CreatedAt = v } return offset, nil } func (p *PusherConfig) FastReadField3(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { return offset, err } else { offset += l p.Type = PusherConfigType(v) } return offset, nil } func (p *PusherConfig) FastReadField4(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Name = v } return offset, nil } func (p *PusherConfig) FastReadField5(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Remark = v } return offset, nil } func (p *PusherConfig) FastReadField6(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Option = v } return offset, nil } // for compatibility func (p *PusherConfig) FastWrite(buf []byte) int { return 0 } func (p *PusherConfig) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PusherConfig") if p != nil { offset += p.fastWriteField1(buf[offset:], binaryWriter) offset += p.fastWriteField2(buf[offset:], binaryWriter) offset += p.fastWriteField3(buf[offset:], binaryWriter) offset += p.fastWriteField4(buf[offset:], binaryWriter) offset += p.fastWriteField5(buf[offset:], binaryWriter) offset += p.fastWriteField6(buf[offset:], binaryWriter) } offset += bthrift.Binary.WriteFieldStop(buf[offset:]) offset += bthrift.Binary.WriteStructEnd(buf[offset:]) return offset } func (p *PusherConfig) BLength() int { l := 0 l += bthrift.Binary.StructBeginLength("PusherConfig") if p != nil { l += p.field1Length() l += p.field2Length() l += p.field3Length() l += p.field4Length() l += p.field5Length() l += p.field6Length() } l += bthrift.Binary.FieldStopLength() l += bthrift.Binary.StructEndLength() return l } func (p *PusherConfig) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "id", thrift.I64, 1) offset += bthrift.Binary.WriteI64(buf[offset:], p.Id) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherConfig) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "createdAt", thrift.I64, 2) offset += bthrift.Binary.WriteI64(buf[offset:], p.CreatedAt) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherConfig) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "type", thrift.I32, 3) offset += bthrift.Binary.WriteI32(buf[offset:], int32(p.Type)) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherConfig) fastWriteField4(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "name", thrift.STRING, 4) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Name) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherConfig) fastWriteField5(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "remark", thrift.STRING, 5) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Remark) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherConfig) fastWriteField6(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "option", thrift.STRING, 6) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Option) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherConfig) field1Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("id", thrift.I64, 1) l += bthrift.Binary.I64Length(p.Id) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherConfig) field2Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("createdAt", thrift.I64, 2) l += bthrift.Binary.I64Length(p.CreatedAt) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherConfig) field3Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("type", thrift.I32, 3) l += bthrift.Binary.I32Length(int32(p.Type)) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherConfig) field4Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("name", thrift.STRING, 4) l += bthrift.Binary.StringLengthNocopy(p.Name) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherConfig) field5Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("remark", thrift.STRING, 5) l += bthrift.Binary.StringLengthNocopy(p.Remark) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherConfig) field6Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("option", thrift.STRING, 6) l += bthrift.Binary.StringLengthNocopy(p.Option) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherOption) FastRead(buf []byte) (int, error) { var err error var offset int var l int var fieldTypeId thrift.TType var fieldId int16 _, l, err = bthrift.Binary.ReadStructBegin(buf) offset += l if err != nil { goto ReadStructBeginError } for { _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) offset += l if err != nil { goto ReadFieldBeginError } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if fieldTypeId == thrift.STRING { l, err = p.FastReadField1(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 2: if fieldTypeId == thrift.I32 { l, err = p.FastReadField2(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 3: if fieldTypeId == thrift.LIST { l, err = p.FastReadField3(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } default: l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) offset += l if err != nil { goto ReadFieldEndError } } l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) offset += l if err != nil { goto ReadStructEndError } return offset, nil ReadStructBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PusherOption[fieldId]), err) SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) ReadFieldEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } func (p *PusherOption) FastReadField1(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Title = v } return offset, nil } func (p *PusherOption) FastReadField2(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { return offset, err } else { offset += l p.Type = PusherConfigType(v) } return offset, nil } func (p *PusherOption) FastReadField3(buf []byte) (int, error) { offset := 0 _, size, l, err := bthrift.Binary.ReadListBegin(buf[offset:]) offset += l if err != nil { return offset, err } p.FormItems = make([]*FormItem, 0, size) for i := 0; i < size; i++ { _elem := NewFormItem() if l, err := _elem.FastRead(buf[offset:]); err != nil { return offset, err } else { offset += l } p.FormItems = append(p.FormItems, _elem) } if l, err := bthrift.Binary.ReadListEnd(buf[offset:]); err != nil { return offset, err } else { offset += l } return offset, nil } // for compatibility func (p *PusherOption) FastWrite(buf []byte) int { return 0 } func (p *PusherOption) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PusherOption") if p != nil { offset += p.fastWriteField1(buf[offset:], binaryWriter) offset += p.fastWriteField2(buf[offset:], binaryWriter) offset += p.fastWriteField3(buf[offset:], binaryWriter) } offset += bthrift.Binary.WriteFieldStop(buf[offset:]) offset += bthrift.Binary.WriteStructEnd(buf[offset:]) return offset } func (p *PusherOption) BLength() int { l := 0 l += bthrift.Binary.StructBeginLength("PusherOption") if p != nil { l += p.field1Length() l += p.field2Length() l += p.field3Length() } l += bthrift.Binary.FieldStopLength() l += bthrift.Binary.StructEndLength() return l } func (p *PusherOption) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "title", thrift.STRING, 1) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Title) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherOption) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "type", thrift.I32, 2) offset += bthrift.Binary.WriteI32(buf[offset:], int32(p.Type)) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherOption) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "formItems", thrift.LIST, 3) listBeginOffset := offset offset += bthrift.Binary.ListBeginLength(thrift.STRUCT, 0) var length int for _, v := range p.FormItems { length++ offset += v.FastWriteNocopy(buf[offset:], binaryWriter) } bthrift.Binary.WriteListBegin(buf[listBeginOffset:], thrift.STRUCT, length) offset += bthrift.Binary.WriteListEnd(buf[offset:]) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *PusherOption) field1Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("title", thrift.STRING, 1) l += bthrift.Binary.StringLengthNocopy(p.Title) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherOption) field2Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("type", thrift.I32, 2) l += bthrift.Binary.I32Length(int32(p.Type)) l += bthrift.Binary.FieldEndLength() return l } func (p *PusherOption) field3Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("formItems", thrift.LIST, 3) l += bthrift.Binary.ListBeginLength(thrift.STRUCT, len(p.FormItems)) for _, v := range p.FormItems { l += v.BLength() } l += bthrift.Binary.ListEndLength() l += bthrift.Binary.FieldEndLength() return l } func (p *FormItem) FastRead(buf []byte) (int, error) { var err error var offset int var l int var fieldTypeId thrift.TType var fieldId int16 _, l, err = bthrift.Binary.ReadStructBegin(buf) offset += l if err != nil { goto ReadStructBeginError } for { _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) offset += l if err != nil { goto ReadFieldBeginError } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if fieldTypeId == thrift.STRING { l, err = p.FastReadField1(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 2: if fieldTypeId == thrift.STRING { l, err = p.FastReadField2(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 3: if fieldTypeId == thrift.BOOL { l, err = p.FastReadField3(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } default: l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) offset += l if err != nil { goto ReadFieldEndError } } l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) offset += l if err != nil { goto ReadStructEndError } return offset, nil ReadStructBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_FormItem[fieldId]), err) SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) ReadFieldEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } func (p *FormItem) FastReadField1(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Param = v } return offset, nil } func (p *FormItem) FastReadField2(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Type = v } return offset, nil } func (p *FormItem) FastReadField3(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadBool(buf[offset:]); err != nil { return offset, err } else { offset += l p.Require = v } return offset, nil } // for compatibility func (p *FormItem) FastWrite(buf []byte) int { return 0 } func (p *FormItem) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "FormItem") if p != nil { offset += p.fastWriteField3(buf[offset:], binaryWriter) offset += p.fastWriteField1(buf[offset:], binaryWriter) offset += p.fastWriteField2(buf[offset:], binaryWriter) } offset += bthrift.Binary.WriteFieldStop(buf[offset:]) offset += bthrift.Binary.WriteStructEnd(buf[offset:]) return offset } func (p *FormItem) BLength() int { l := 0 l += bthrift.Binary.StructBeginLength("FormItem") if p != nil { l += p.field1Length() l += p.field2Length() l += p.field3Length() } l += bthrift.Binary.FieldStopLength() l += bthrift.Binary.StructEndLength() return l } func (p *FormItem) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "param", thrift.STRING, 1) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Param) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *FormItem) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "type", thrift.STRING, 2) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Type) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *FormItem) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "require", thrift.BOOL, 3) offset += bthrift.Binary.WriteBool(buf[offset:], p.Require) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *FormItem) field1Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("param", thrift.STRING, 1) l += bthrift.Binary.StringLengthNocopy(p.Param) l += bthrift.Binary.FieldEndLength() return l } func (p *FormItem) field2Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("type", thrift.STRING, 2) l += bthrift.Binary.StringLengthNocopy(p.Type) l += bthrift.Binary.FieldEndLength() return l } func (p *FormItem) field3Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("require", thrift.BOOL, 3) l += bthrift.Binary.BoolLength(p.Require) l += bthrift.Binary.FieldEndLength() return l } func (p *AnPush) FastRead(buf []byte) (int, error) { var err error var offset int var l int var fieldTypeId thrift.TType var fieldId int16 _, l, err = bthrift.Binary.ReadStructBegin(buf) offset += l if err != nil { goto ReadStructBeginError } for { _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) offset += l if err != nil { goto ReadFieldBeginError } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if fieldTypeId == thrift.STRING { l, err = p.FastReadField1(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 2: if fieldTypeId == thrift.STRING { l, err = p.FastReadField2(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } default: l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) offset += l if err != nil { goto ReadFieldEndError } } l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) offset += l if err != nil { goto ReadStructEndError } return offset, nil ReadStructBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AnPush[fieldId]), err) SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) ReadFieldEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } func (p *AnPush) FastReadField1(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Token = v } return offset, nil } func (p *AnPush) FastReadField2(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Channel = v } return offset, nil } // for compatibility func (p *AnPush) FastWrite(buf []byte) int { return 0 } func (p *AnPush) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "AnPush") if p != nil { offset += p.fastWriteField1(buf[offset:], binaryWriter) offset += p.fastWriteField2(buf[offset:], binaryWriter) } offset += bthrift.Binary.WriteFieldStop(buf[offset:]) offset += bthrift.Binary.WriteStructEnd(buf[offset:]) return offset } func (p *AnPush) BLength() int { l := 0 l += bthrift.Binary.StructBeginLength("AnPush") if p != nil { l += p.field1Length() l += p.field2Length() } l += bthrift.Binary.FieldStopLength() l += bthrift.Binary.StructEndLength() return l } func (p *AnPush) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "token", thrift.STRING, 1) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Token) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *AnPush) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "channel", thrift.STRING, 2) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Channel) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *AnPush) field1Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("token", thrift.STRING, 1) l += bthrift.Binary.StringLengthNocopy(p.Token) l += bthrift.Binary.FieldEndLength() return l } func (p *AnPush) field2Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("channel", thrift.STRING, 2) l += bthrift.Binary.StringLengthNocopy(p.Channel) l += bthrift.Binary.FieldEndLength() return l } func (p *EmailPush) FastRead(buf []byte) (int, error) { var err error var offset int var l int var fieldTypeId thrift.TType var fieldId int16 _, l, err = bthrift.Binary.ReadStructBegin(buf) offset += l if err != nil { goto ReadStructBeginError } for { _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) offset += l if err != nil { goto ReadFieldBeginError } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if fieldTypeId == thrift.STRING { l, err = p.FastReadField1(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 2: if fieldTypeId == thrift.STRING { l, err = p.FastReadField2(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 3: if fieldTypeId == thrift.STRING { l, err = p.FastReadField3(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 4: if fieldTypeId == thrift.STRING { l, err = p.FastReadField4(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 5: if fieldTypeId == thrift.STRING { l, err = p.FastReadField5(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } case 6: if fieldTypeId == thrift.I32 { l, err = p.FastReadField6(buf[offset:]) offset += l if err != nil { goto ReadFieldError } } else { l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } default: l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l if err != nil { goto SkipFieldError } } l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) offset += l if err != nil { goto ReadFieldEndError } } l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) offset += l if err != nil { goto ReadStructEndError } return offset, nil ReadStructBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_EmailPush[fieldId]), err) SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) ReadFieldEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } func (p *EmailPush) FastReadField1(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.From = v } return offset, nil } func (p *EmailPush) FastReadField2(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.To = v } return offset, nil } func (p *EmailPush) FastReadField3(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Username = v } return offset, nil } func (p *EmailPush) FastReadField4(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Password = v } return offset, nil } func (p *EmailPush) FastReadField5(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { return offset, err } else { offset += l p.Host = v } return offset, nil } func (p *EmailPush) FastReadField6(buf []byte) (int, error) { offset := 0 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { return offset, err } else { offset += l p.Port = v } return offset, nil } // for compatibility func (p *EmailPush) FastWrite(buf []byte) int { return 0 } func (p *EmailPush) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "EmailPush") if p != nil { offset += p.fastWriteField6(buf[offset:], binaryWriter) offset += p.fastWriteField1(buf[offset:], binaryWriter) offset += p.fastWriteField2(buf[offset:], binaryWriter) offset += p.fastWriteField3(buf[offset:], binaryWriter) offset += p.fastWriteField4(buf[offset:], binaryWriter) offset += p.fastWriteField5(buf[offset:], binaryWriter) } offset += bthrift.Binary.WriteFieldStop(buf[offset:]) offset += bthrift.Binary.WriteStructEnd(buf[offset:]) return offset } func (p *EmailPush) BLength() int { l := 0 l += bthrift.Binary.StructBeginLength("EmailPush") if p != nil { l += p.field1Length() l += p.field2Length() l += p.field3Length() l += p.field4Length() l += p.field5Length() l += p.field6Length() } l += bthrift.Binary.FieldStopLength() l += bthrift.Binary.StructEndLength() return l } func (p *EmailPush) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "from", thrift.STRING, 1) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.From) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *EmailPush) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "to", thrift.STRING, 2) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.To) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *EmailPush) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "username", thrift.STRING, 3) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Username) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *EmailPush) fastWriteField4(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "password", thrift.STRING, 4) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Password) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *EmailPush) fastWriteField5(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "host", thrift.STRING, 5) offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.Host) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *EmailPush) fastWriteField6(buf []byte, binaryWriter bthrift.BinaryWriter) int { offset := 0 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "port", thrift.I32, 6) offset += bthrift.Binary.WriteI32(buf[offset:], p.Port) offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) return offset } func (p *EmailPush) field1Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("from", thrift.STRING, 1) l += bthrift.Binary.StringLengthNocopy(p.From) l += bthrift.Binary.FieldEndLength() return l } func (p *EmailPush) field2Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("to", thrift.STRING, 2) l += bthrift.Binary.StringLengthNocopy(p.To) l += bthrift.Binary.FieldEndLength() return l } func (p *EmailPush) field3Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("username", thrift.STRING, 3) l += bthrift.Binary.StringLengthNocopy(p.Username) l += bthrift.Binary.FieldEndLength() return l } func (p *EmailPush) field4Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("password", thrift.STRING, 4) l += bthrift.Binary.StringLengthNocopy(p.Password) l += bthrift.Binary.FieldEndLength() return l } func (p *EmailPush) field5Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("host", thrift.STRING, 5) l += bthrift.Binary.StringLengthNocopy(p.Host) l += bthrift.Binary.FieldEndLength() return l } func (p *EmailPush) field6Length() int { l := 0 l += bthrift.Binary.FieldBeginLength("port", thrift.I32, 6) l += bthrift.Binary.I32Length(p.Port) l += bthrift.Binary.FieldEndLength() return l }