395 lines
9.3 KiB
Go
395 lines
9.3 KiB
Go
// Code generated by Kitex v0.9.0. 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 *PushConfig) 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.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.BYTE {
|
|
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.STRING {
|
|
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_PushConfig[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 *PushConfig) 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 *PushConfig) 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 *PushConfig) FastReadField3(buf []byte) (int, error) {
|
|
offset := 0
|
|
|
|
if v, l, err := bthrift.Binary.ReadByte(buf[offset:]); err != nil {
|
|
return offset, err
|
|
} else {
|
|
offset += l
|
|
|
|
p.Type = v
|
|
|
|
}
|
|
return offset, nil
|
|
}
|
|
|
|
func (p *PushConfig) 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 *PushConfig) 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 *PushConfig) 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 *PushConfig) FastWrite(buf []byte) int {
|
|
return 0
|
|
}
|
|
|
|
func (p *PushConfig) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int {
|
|
offset := 0
|
|
offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PushConfig")
|
|
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 *PushConfig) BLength() int {
|
|
l := 0
|
|
l += bthrift.Binary.StructBeginLength("PushConfig")
|
|
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 *PushConfig) 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 *PushConfig) 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 *PushConfig) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int {
|
|
offset := 0
|
|
offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "type", thrift.BYTE, 3)
|
|
offset += bthrift.Binary.WriteByte(buf[offset:], p.Type)
|
|
|
|
offset += bthrift.Binary.WriteFieldEnd(buf[offset:])
|
|
return offset
|
|
}
|
|
|
|
func (p *PushConfig) 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 *PushConfig) 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 *PushConfig) 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 *PushConfig) 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 *PushConfig) 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 *PushConfig) field3Length() int {
|
|
l := 0
|
|
l += bthrift.Binary.FieldBeginLength("type", thrift.BYTE, 3)
|
|
l += bthrift.Binary.ByteLength(p.Type)
|
|
|
|
l += bthrift.Binary.FieldEndLength()
|
|
return l
|
|
}
|
|
|
|
func (p *PushConfig) 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 *PushConfig) 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 *PushConfig) field6Length() int {
|
|
l := 0
|
|
l += bthrift.Binary.FieldBeginLength("option", thrift.STRING, 6)
|
|
l += bthrift.Binary.StringLengthNocopy(p.Option)
|
|
|
|
l += bthrift.Binary.FieldEndLength()
|
|
return l
|
|
}
|