unknown

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package unknown .

Package unknown provides definitions that work with the thriftgo `keep_unknown_fields` option. When the option is turned on, thriftgo generates an extra field `_unknownFields` for each structure defined in the IDL to store fields that are not recognized by the current IDL when deserializing data. Those unknown fields will be written out at the end of the data stream when serializing the structure that carries them.

Index

Constants

View Source
const (
	TStop   = 0
	TVoid   = 1
	TBool   = 2
	TByte   = 3
	TDouble = 4
	TI16    = 6
	TI32    = 8
	TI64    = 10
	TString = 11
	TStruct = 12
	TMap    = 13
	TSet    = 14
	TList   = 15
	TUtf8   = 16
	TUtf16  = 17
)

Type IDs.

Variables

View Source
var (
	ErrExceedDepthLimit = errors.New("depth limit exceeded")

	ErrUnknownType = func(t int) error {
		return fmt.Errorf("unknown data type %d", t)
	}
)

errors .

View Source
var Binary binaryProtocol

Binary protocol for bthrift.

View Source
var InvalidDataLength = errors.New("invalid data length")

Functions

func SetNestingDepthLimit

func SetNestingDepthLimit(d int)

SetNestingDepthLimit sets the max number of nesting level.

Types

type Fields

type Fields []byte

Fields stores all undeserialized unknown fields.

func (*Fields) Append

func (fs *Fields) Append(xprot TProtocol, name string, fieldType TType, id int16) error

Append reads an object of a generalized type from xprot and serializes the object into Fields for compatibility with the thrift interface, and the performance is greatly discounted for this reason.

[Deprecated]: Use the FastCodec api provided by Kitex for serialization/deserialization to improve performance.

func (*Fields) Write

func (fs *Fields) Write(xprot TProtocol) (err error)

Write reads an object of a generalized type from Fields and srializes the object into xprot for compatibility with the thrift interface, and the performance is greatly discounted for this reason.

[Deprecated]: Use the FastCodec api provided by Kitex for serialization/deserialization to improve performance.

type TProtocol added in v0.2.0

type TProtocol interface{}

TProtocol is supposed to have methods that a thrift.TProtocol requires.

type TType added in v0.2.0

type TType interface{}

TType is supposed to be an integer.

type WithUnknownFields

type WithUnknownFields interface {
	// CarryingUnknownFields tells whether the structure contains data from fields not recognized by the current IDL.
	CarryingUnknownFields() bool
}

WithUnknownFields is the interface of all structures that supports keeping unknown fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL