Documentation ¶
Overview ¶
Package flatbuffers provides facilities to read and write flatbuffers objects.
Index ¶
- Constants
- Variables
- func GetBool(buf []byte) bool
- func GetByte(buf []byte) byte
- func GetFloat32(buf []byte) float32
- func GetFloat64(buf []byte) float64
- func GetInt16(buf []byte) (n int16)
- func GetInt32(buf []byte) (n int32)
- func GetInt64(buf []byte) (n int64)
- func GetInt8(buf []byte) (n int8)
- func GetRootAs(buf []byte, offset UOffsetT, fb FlatBuffer)
- func GetSizePrefix(buf []byte, offset UOffsetT) uint32
- func GetSizePrefixedRootAs(buf []byte, offset UOffsetT, fb FlatBuffer)
- func GetUint16(buf []byte) (n uint16)
- func GetUint32(buf []byte) (n uint32)
- func GetUint64(buf []byte) (n uint64)
- func GetUint8(buf []byte) (n uint8)
- func WriteBool(buf []byte, b bool)
- func WriteByte(buf []byte, n byte)
- func WriteFloat32(buf []byte, n float32)
- func WriteFloat64(buf []byte, n float64)
- func WriteInt16(buf []byte, n int16)
- func WriteInt32(buf []byte, n int32)
- func WriteInt64(buf []byte, n int64)
- func WriteInt8(buf []byte, n int8)
- func WriteSOffsetT(buf []byte, n SOffsetT)
- func WriteUOffsetT(buf []byte, n UOffsetT)
- func WriteUint16(buf []byte, n uint16)
- func WriteUint32(buf []byte, n uint32)
- func WriteUint64(buf []byte, n uint64)
- func WriteUint8(buf []byte, n uint8)
- func WriteVOffsetT(buf []byte, n VOffsetT)
- type Builder
- func (b *Builder) CreateByteString(s []byte) UOffsetT
- func (b *Builder) CreateByteVector(v []byte) UOffsetT
- func (b *Builder) CreateSharedString(s string) UOffsetT
- func (b *Builder) CreateString(s string) UOffsetT
- func (b *Builder) CreateVectorOfSortedTables(offsets []UOffsetT, keyCompare KeyCompare) UOffsetT
- func (b *Builder) CreateVectorOfTables(offsets []UOffsetT) UOffsetT
- func (b *Builder) EndObject() UOffsetT
- func (b *Builder) EndVector(vectorNumElems int) UOffsetT
- func (b *Builder) Finish(rootTable UOffsetT)
- func (b *Builder) FinishSizePrefixed(rootTable UOffsetT)
- func (b *Builder) FinishSizePrefixedWithFileIdentifier(rootTable UOffsetT, fid []byte)
- func (b *Builder) FinishWithFileIdentifier(rootTable UOffsetT, fid []byte)
- func (b *Builder) FinishedBytes() []byte
- func (b *Builder) Head() UOffsetT
- func (b *Builder) Offset() UOffsetT
- func (b *Builder) Pad(n int)
- func (b *Builder) PlaceBool(x bool)
- func (b *Builder) PlaceByte(x byte)
- func (b *Builder) PlaceFloat32(x float32)
- func (b *Builder) PlaceFloat64(x float64)
- func (b *Builder) PlaceInt16(x int16)
- func (b *Builder) PlaceInt32(x int32)
- func (b *Builder) PlaceInt64(x int64)
- func (b *Builder) PlaceInt8(x int8)
- func (b *Builder) PlaceSOffsetT(x SOffsetT)
- func (b *Builder) PlaceUOffsetT(x UOffsetT)
- func (b *Builder) PlaceUint16(x uint16)
- func (b *Builder) PlaceUint32(x uint32)
- func (b *Builder) PlaceUint64(x uint64)
- func (b *Builder) PlaceUint8(x uint8)
- func (b *Builder) PlaceVOffsetT(x VOffsetT)
- func (b *Builder) Prep(size, additionalBytes int)
- func (b *Builder) PrependBool(x bool)
- func (b *Builder) PrependBoolSlot(o int, x, d bool)
- func (b *Builder) PrependByte(x byte)
- func (b *Builder) PrependByteSlot(o int, x, d byte)
- func (b *Builder) PrependFloat32(x float32)
- func (b *Builder) PrependFloat32Slot(o int, x, d float32)
- func (b *Builder) PrependFloat64(x float64)
- func (b *Builder) PrependFloat64Slot(o int, x, d float64)
- func (b *Builder) PrependInt16(x int16)
- func (b *Builder) PrependInt16Slot(o int, x, d int16)
- func (b *Builder) PrependInt32(x int32)
- func (b *Builder) PrependInt32Slot(o int, x, d int32)
- func (b *Builder) PrependInt64(x int64)
- func (b *Builder) PrependInt64Slot(o int, x, d int64)
- func (b *Builder) PrependInt8(x int8)
- func (b *Builder) PrependInt8Slot(o int, x, d int8)
- func (b *Builder) PrependSOffsetT(off SOffsetT)
- func (b *Builder) PrependStructSlot(voffset int, x, d UOffsetT)
- func (b *Builder) PrependUOffsetT(off UOffsetT)
- func (b *Builder) PrependUOffsetTSlot(o int, x, d UOffsetT)
- func (b *Builder) PrependUint16(x uint16)
- func (b *Builder) PrependUint16Slot(o int, x, d uint16)
- func (b *Builder) PrependUint32(x uint32)
- func (b *Builder) PrependUint32Slot(o int, x, d uint32)
- func (b *Builder) PrependUint64(x uint64)
- func (b *Builder) PrependUint64Slot(o int, x, d uint64)
- func (b *Builder) PrependUint8(x uint8)
- func (b *Builder) PrependUint8Slot(o int, x, d uint8)
- func (b *Builder) PrependVOffsetT(x VOffsetT)
- func (b *Builder) Reset()
- func (b *Builder) Slot(slotnum int)
- func (b *Builder) StartObject(numfields int)
- func (b *Builder) StartVector(elemSize, numElems, alignment int) UOffsetT
- func (b *Builder) WriteVtable() (n UOffsetT)
- type FlatBuffer
- type FlatbuffersCodec
- type KeyCompare
- type SOffsetT
- type Struct
- type Table
- func (t *Table) ByteVector(off UOffsetT) []byte
- func (t *Table) GetBool(off UOffsetT) bool
- func (t *Table) GetBoolSlot(slot VOffsetT, d bool) bool
- func (t *Table) GetByte(off UOffsetT) byte
- func (t *Table) GetByteSlot(slot VOffsetT, d byte) byte
- func (t *Table) GetFloat32(off UOffsetT) float32
- func (t *Table) GetFloat32Slot(slot VOffsetT, d float32) float32
- func (t *Table) GetFloat64(off UOffsetT) float64
- func (t *Table) GetFloat64Slot(slot VOffsetT, d float64) float64
- func (t *Table) GetInt16(off UOffsetT) int16
- func (t *Table) GetInt16Slot(slot VOffsetT, d int16) int16
- func (t *Table) GetInt32(off UOffsetT) int32
- func (t *Table) GetInt32Slot(slot VOffsetT, d int32) int32
- func (t *Table) GetInt64(off UOffsetT) int64
- func (t *Table) GetInt64Slot(slot VOffsetT, d int64) int64
- func (t *Table) GetInt8(off UOffsetT) int8
- func (t *Table) GetInt8Slot(slot VOffsetT, d int8) int8
- func (t *Table) GetSOffsetT(off UOffsetT) SOffsetT
- func (t *Table) GetUOffsetT(off UOffsetT) UOffsetT
- func (t *Table) GetUint16(off UOffsetT) uint16
- func (t *Table) GetUint16Slot(slot VOffsetT, d uint16) uint16
- func (t *Table) GetUint32(off UOffsetT) uint32
- func (t *Table) GetUint32Slot(slot VOffsetT, d uint32) uint32
- func (t *Table) GetUint64(off UOffsetT) uint64
- func (t *Table) GetUint64Slot(slot VOffsetT, d uint64) uint64
- func (t *Table) GetUint8(off UOffsetT) uint8
- func (t *Table) GetUint8Slot(slot VOffsetT, d uint8) uint8
- func (t *Table) GetVOffsetT(off UOffsetT) VOffsetT
- func (t *Table) GetVOffsetTSlot(slot VOffsetT, d VOffsetT) VOffsetT
- func (t *Table) Indirect(off UOffsetT) UOffsetT
- func (t *Table) MutateBool(off UOffsetT, n bool) bool
- func (t *Table) MutateBoolSlot(slot VOffsetT, n bool) bool
- func (t *Table) MutateByte(off UOffsetT, n byte) bool
- func (t *Table) MutateByteSlot(slot VOffsetT, n byte) bool
- func (t *Table) MutateFloat32(off UOffsetT, n float32) bool
- func (t *Table) MutateFloat32Slot(slot VOffsetT, n float32) bool
- func (t *Table) MutateFloat64(off UOffsetT, n float64) bool
- func (t *Table) MutateFloat64Slot(slot VOffsetT, n float64) bool
- func (t *Table) MutateInt16(off UOffsetT, n int16) bool
- func (t *Table) MutateInt16Slot(slot VOffsetT, n int16) bool
- func (t *Table) MutateInt32(off UOffsetT, n int32) bool
- func (t *Table) MutateInt32Slot(slot VOffsetT, n int32) bool
- func (t *Table) MutateInt64(off UOffsetT, n int64) bool
- func (t *Table) MutateInt64Slot(slot VOffsetT, n int64) bool
- func (t *Table) MutateInt8(off UOffsetT, n int8) bool
- func (t *Table) MutateInt8Slot(slot VOffsetT, n int8) bool
- func (t *Table) MutateSOffsetT(off UOffsetT, n SOffsetT) bool
- func (t *Table) MutateUOffsetT(off UOffsetT, n UOffsetT) bool
- func (t *Table) MutateUint16(off UOffsetT, n uint16) bool
- func (t *Table) MutateUint16Slot(slot VOffsetT, n uint16) bool
- func (t *Table) MutateUint32(off UOffsetT, n uint32) bool
- func (t *Table) MutateUint32Slot(slot VOffsetT, n uint32) bool
- func (t *Table) MutateUint64(off UOffsetT, n uint64) bool
- func (t *Table) MutateUint64Slot(slot VOffsetT, n uint64) bool
- func (t *Table) MutateUint8(off UOffsetT, n uint8) bool
- func (t *Table) MutateUint8Slot(slot VOffsetT, n uint8) bool
- func (t *Table) MutateVOffsetT(off UOffsetT, n VOffsetT) bool
- func (t Table) NumFields() VOffsetT
- func (t *Table) Offset(vtableOffset VOffsetT) VOffsetT
- func (t *Table) String(off UOffsetT) string
- func (t *Table) Union(t2 *Table, off UOffsetT)
- func (t *Table) Vector(off UOffsetT) UOffsetT
- func (t *Table) VectorLen(off UOffsetT) int
- type UOffsetT
- type VOffsetT
Constants ¶
const ( // SizeUint8 is the byte size of a uint8. SizeUint8 = 1 // SizeUint16 is the byte size of a uint16. SizeUint16 = 2 // SizeUint32 is the byte size of a uint32. SizeUint32 = 4 // SizeUint64 is the byte size of a uint64. SizeUint64 = 8 // SizeInt8 is the byte size of a int8. SizeInt8 = 1 // SizeInt16 is the byte size of a int16. SizeInt16 = 2 // SizeInt32 is the byte size of a int32. SizeInt32 = 4 // SizeInt64 is the byte size of a int64. SizeInt64 = 8 // SizeFloat32 is the byte size of a float32. SizeFloat32 = 4 // SizeFloat64 is the byte size of a float64. SizeFloat64 = 8 // SizeByte is the byte size of a byte. // The `byte` type is aliased (by Go definition) to uint8. SizeByte = 1 // SizeBool is the byte size of a bool. // The `bool` type is aliased (by flatbuffers convention) to uint8. SizeBool = 1 // SizeSOffsetT is the byte size of an SOffsetT. // The `SOffsetT` type is aliased (by flatbuffers convention) to int32. SizeSOffsetT = 4 // SizeUOffsetT is the byte size of an UOffsetT. // The `UOffsetT` type is aliased (by flatbuffers convention) to uint32. SizeUOffsetT = 4 // SizeVOffsetT is the byte size of an VOffsetT. // The `VOffsetT` type is aliased (by flatbuffers convention) to uint16. SizeVOffsetT = 2 )
const (
// VtableMetadataFields is the count of metadata fields in each vtable.
VtableMetadataFields = 2
)
Variables ¶
var Codec = "flatbuffers"
Codec implements gRPC-go Codec which is used to encode and decode messages.
var ErrTableHasUnknownFields = errors.New("table has unknown fields")
Returned from TryGet...AsRoot functions when a table being read has more fields than the generated code knows about.
Functions ¶
func GetFloat32 ¶
GetFloat32 decodes a little-endian float32 from a byte slice.
func GetFloat64 ¶
GetFloat64 decodes a little-endian float64 from a byte slice.
func GetRootAs ¶
func GetRootAs(buf []byte, offset UOffsetT, fb FlatBuffer)
GetRootAs is a generic helper to initialize a FlatBuffer with the provided buffer bytes and its data offset.
func GetSizePrefix ¶
GetSizePrefix reads the size from a size-prefixed flatbuffer
func GetSizePrefixedRootAs ¶
func GetSizePrefixedRootAs(buf []byte, offset UOffsetT, fb FlatBuffer)
GetSizePrefixedRootAs is a generic helper to initialize a FlatBuffer with the provided size-prefixed buffer bytes and its data offset
func WriteFloat32 ¶
WriteFloat32 encodes a little-endian float32 into a byte slice.
func WriteFloat64 ¶
WriteFloat64 encodes a little-endian float64 into a byte slice.
func WriteInt16 ¶
WriteInt16 encodes a little-endian int16 into a byte slice.
func WriteInt32 ¶
WriteInt32 encodes a little-endian int32 into a byte slice.
func WriteInt64 ¶
WriteInt64 encodes a little-endian int64 into a byte slice.
func WriteSOffsetT ¶
WriteSOffsetT encodes a little-endian SOffsetT into a byte slice.
func WriteUOffsetT ¶
WriteUOffsetT encodes a little-endian UOffsetT into a byte slice.
func WriteUint16 ¶
WriteUint16 encodes a little-endian uint16 into a byte slice.
func WriteUint32 ¶
WriteUint32 encodes a little-endian uint32 into a byte slice.
func WriteUint64 ¶
WriteUint64 encodes a little-endian uint64 into a byte slice.
func WriteUint8 ¶
WriteUint8 encodes a little-endian uint8 into a byte slice.
func WriteVOffsetT ¶
WriteVOffsetT encodes a little-endian VOffsetT into a byte slice.
Types ¶
type Builder ¶
type Builder struct { // `Bytes` gives raw access to the buffer. Most users will want to use // FinishedBytes() instead. Bytes []byte // contains filtered or unexported fields }
Builder is a state machine for creating FlatBuffer objects. Use a Builder to construct object(s) starting from leaf nodes.
A Builder constructs byte buffers in a last-first manner for simplicity and performance.
func NewBuilder ¶
NewBuilder initializes a Builder of size `initial_size`. The internal buffer is grown as needed.
func (*Builder) CreateByteString ¶
CreateByteString writes a byte slice as a string (null-terminated).
func (*Builder) CreateByteVector ¶
CreateByteVector writes a ubyte vector
func (*Builder) CreateSharedString ¶
CreateSharedString Checks if the string is already written to the buffer before calling CreateString
func (*Builder) CreateString ¶
CreateString writes a null-terminated string as a vector.
func (*Builder) CreateVectorOfSortedTables ¶
func (b *Builder) CreateVectorOfSortedTables(offsets []UOffsetT, keyCompare KeyCompare) UOffsetT
func (*Builder) CreateVectorOfTables ¶
CreateVectorOfTables serializes slice of table offsets into a vector.
func (*Builder) FinishSizePrefixed ¶
FinishSizePrefixed finalizes a buffer, pointing to the given `rootTable`. The buffer is prefixed with the size of the buffer, excluding the size of the prefix itself.
func (*Builder) FinishSizePrefixedWithFileIdentifier ¶
FinishSizePrefixedWithFileIdentifier finalizes a buffer, pointing to the given `rootTable` and applies a file identifier. The buffer is prefixed with the size of the buffer, excluding the size of the prefix itself.
func (*Builder) FinishWithFileIdentifier ¶
FinishWithFileIdentifier finalizes a buffer, pointing to the given `rootTable`. as well as applys a file identifier
func (*Builder) FinishedBytes ¶
FinishedBytes returns a pointer to the written data in the byte buffer. Panics if the builder is not in a finished state (which is caused by calling `Finish()`).
func (*Builder) Head ¶
Head gives the start of useful data in the underlying byte buffer. Note: unlike other functions, this value is interpreted as from the left.
func (*Builder) PlaceFloat32 ¶
PlaceFloat32 prepends a float32 to the Builder, without checking for space.
func (*Builder) PlaceFloat64 ¶
PlaceFloat64 prepends a float64 to the Builder, without checking for space.
func (*Builder) PlaceInt16 ¶
PlaceInt16 prepends a int16 to the Builder, without checking for space.
func (*Builder) PlaceInt32 ¶
PlaceInt32 prepends a int32 to the Builder, without checking for space.
func (*Builder) PlaceInt64 ¶
PlaceInt64 prepends a int64 to the Builder, without checking for space.
func (*Builder) PlaceSOffsetT ¶
PlaceSOffsetT prepends a SOffsetT to the Builder, without checking for space.
func (*Builder) PlaceUOffsetT ¶
PlaceUOffsetT prepends a UOffsetT to the Builder, without checking for space.
func (*Builder) PlaceUint16 ¶
PlaceUint16 prepends a uint16 to the Builder, without checking for space.
func (*Builder) PlaceUint32 ¶
PlaceUint32 prepends a uint32 to the Builder, without checking for space.
func (*Builder) PlaceUint64 ¶
PlaceUint64 prepends a uint64 to the Builder, without checking for space.
func (*Builder) PlaceUint8 ¶
PlaceUint8 prepends a uint8 to the Builder, without checking for space.
func (*Builder) PlaceVOffsetT ¶
PlaceVOffsetT prepends a VOffsetT to the Builder, without checking for space.
func (*Builder) Prep ¶
Prep prepares to write an element of `size` after `additional_bytes` have been written, e.g. if you write a string, you need to align such the int length field is aligned to SizeInt32, and the string data follows it directly. If all you need to do is align, `additionalBytes` will be 0.
func (*Builder) PrependBool ¶
PrependBool prepends a bool to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependBoolSlot ¶
PrependBoolSlot prepends a bool onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependByte ¶
PrependByte prepends a byte to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependByteSlot ¶
PrependByteSlot prepends a byte onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependFloat32 ¶
PrependFloat32 prepends a float32 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependFloat32Slot ¶
PrependFloat32Slot prepends a float32 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependFloat64 ¶
PrependFloat64 prepends a float64 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependFloat64Slot ¶
PrependFloat64Slot prepends a float64 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependInt16 ¶
PrependInt16 prepends a int16 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependInt16Slot ¶
PrependInt16Slot prepends a int16 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependInt32 ¶
PrependInt32 prepends a int32 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependInt32Slot ¶
PrependInt32Slot prepends a int32 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependInt64 ¶
PrependInt64 prepends a int64 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependInt64Slot ¶
PrependInt64Slot prepends a int64 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependInt8 ¶
PrependInt8 prepends a int8 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependInt8Slot ¶
PrependInt8Slot prepends a int8 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependSOffsetT ¶
PrependSOffsetT prepends an SOffsetT, relative to where it will be written.
func (*Builder) PrependStructSlot ¶
PrependStructSlot prepends a struct onto the object at vtable slot `o`. Structs are stored inline, so nothing additional is being added. In generated code, `d` is always 0.
func (*Builder) PrependUOffsetT ¶
PrependUOffsetT prepends an UOffsetT, relative to where it will be written.
func (*Builder) PrependUOffsetTSlot ¶
PrependUOffsetTSlot prepends an UOffsetT onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependUint16 ¶
PrependUint16 prepends a uint16 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependUint16Slot ¶
PrependUint16Slot prepends a uint16 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependUint32 ¶
PrependUint32 prepends a uint32 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependUint32Slot ¶
PrependUint32Slot prepends a uint32 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependUint64 ¶
PrependUint64 prepends a uint64 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependUint64Slot ¶
PrependUint64Slot prepends a uint64 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependUint8 ¶
PrependUint8 prepends a uint8 to the Builder buffer. Aligns and checks for space.
func (*Builder) PrependUint8Slot ¶
PrependUint8Slot prepends a uint8 onto the object at vtable slot `o`. If value `x` equals default `d`, then the slot will be set to zero and no other data will be written.
func (*Builder) PrependVOffsetT ¶
PrependVOffsetT prepends a VOffsetT to the Builder buffer. Aligns and checks for space.
func (*Builder) Reset ¶
func (b *Builder) Reset()
Reset truncates the underlying Builder buffer, facilitating alloc-free reuse of a Builder. It also resets bookkeeping data.
func (*Builder) StartObject ¶
StartObject initializes bookkeeping for writing a new object.
func (*Builder) StartVector ¶
StartVector initializes bookkeeping for writing a new vector.
A vector has the following format:
<UOffsetT: number of elements in this vector> <T: data>+, where T is the type of elements of this vector.
func (*Builder) WriteVtable ¶
WriteVtable serializes the vtable for the current object, if applicable.
Before writing out the vtable, this checks pre-existing vtables for equality to this one. If an equal vtable is found, point the object to the existing vtable and return.
Because vtable values are sensitive to alignment of object data, not all logically-equal vtables will be deduplicated.
A vtable has the following format:
<VOffsetT: size of the vtable in bytes, including this value> <VOffsetT: size of the object in bytes, including the vtable offset> <VOffsetT: offset for a field> * N, where N is the number of fields in the schema for this type. Includes deprecated fields.
Thus, a vtable is made of 2 + N elements, each SizeVOffsetT bytes wide.
An object has the following format:
<SOffsetT: offset to this object's vtable (may be negative)> <byte: data>+
type FlatBuffer ¶
FlatBuffer is the interface that represents a flatbuffer.
type FlatbuffersCodec ¶
type FlatbuffersCodec struct{}
FlatbuffersCodec defines the interface gRPC uses to encode and decode messages. Note that implementations of this interface must be thread safe; a Codec's methods can be called from concurrent goroutines.
func (FlatbuffersCodec) Marshal ¶
func (FlatbuffersCodec) Marshal(v interface{}) ([]byte, error)
Marshal returns the wire format of v.
func (FlatbuffersCodec) Name ¶
func (FlatbuffersCodec) Name() string
Name returns the name of the Codec implementation. The returned string will be used as part of content type in transmission. The result must be static; the result cannot change between calls.
add Name() for ForceCodec interface
func (FlatbuffersCodec) String ¶
func (FlatbuffersCodec) String() string
String old gRPC Codec interface func
func (FlatbuffersCodec) Unmarshal ¶
func (FlatbuffersCodec) Unmarshal(data []byte, v interface{}) error
Unmarshal parses the wire format into v.
type KeyCompare ¶
type SOffsetT ¶
type SOffsetT int32
A SOffsetT stores a signed offset into arbitrary data.
func GetSOffsetT ¶
GetSOffsetT decodes a little-endian SOffsetT from a byte slice.
type Struct ¶
type Struct struct {
Table
}
Struct wraps a byte slice and provides read access to its data.
Structs do not have a vtable.
type Table ¶
Table wraps a byte slice and provides read access to its data.
The variable `Pos` indicates the root of the FlatBuffers object therein.
func (*Table) ByteVector ¶
ByteVector gets a byte slice from data stored inside the flatbuffer.
func (*Table) GetBoolSlot ¶
GetBoolSlot retrieves the bool that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetByteSlot ¶
GetByteSlot retrieves the byte that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetFloat32 ¶
GetFloat32 retrieves a float32 at the given offset.
func (*Table) GetFloat32Slot ¶
GetFloat32Slot retrieves the float32 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetFloat64 ¶
GetFloat64 retrieves a float64 at the given offset.
func (*Table) GetFloat64Slot ¶
GetFloat64Slot retrieves the float64 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetInt16Slot ¶
GetInt16Slot retrieves the int16 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetInt32Slot ¶
GetInt32Slot retrieves the int32 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetInt64Slot ¶
GetInt64Slot retrieves the int64 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetInt8Slot ¶
GetInt8Slot retrieves the int8 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetSOffsetT ¶
GetSOffsetT retrieves a SOffsetT at the given offset.
func (*Table) GetUOffsetT ¶
GetUOffsetT retrieves a UOffsetT at the given offset.
func (*Table) GetUint16Slot ¶
GetUint16Slot retrieves the uint16 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetUint32Slot ¶
GetUint32Slot retrieves the uint32 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetUint64Slot ¶
GetUint64Slot retrieves the uint64 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetUint8Slot ¶
GetUint8Slot retrieves the uint8 that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) GetVOffsetT ¶
GetVOffsetT retrieves a VOffsetT at the given offset.
func (*Table) GetVOffsetTSlot ¶
GetVOffsetTSlot retrieves the VOffsetT that the given vtable location points to. If the vtable value is zero, the default value `d` will be returned.
func (*Table) MutateBool ¶
MutateBool updates a bool at the given offset.
func (*Table) MutateBoolSlot ¶
MutateBoolSlot updates the bool at given vtable location
func (*Table) MutateByte ¶
MutateByte updates a Byte at the given offset.
func (*Table) MutateByteSlot ¶
MutateByteSlot updates the byte at given vtable location
func (*Table) MutateFloat32 ¶
MutateFloat32 updates a Float32 at the given offset.
func (*Table) MutateFloat32Slot ¶
MutateFloat32Slot updates the float32 at given vtable location
func (*Table) MutateFloat64 ¶
MutateFloat64 updates a Float64 at the given offset.
func (*Table) MutateFloat64Slot ¶
MutateFloat64Slot updates the float64 at given vtable location
func (*Table) MutateInt16 ¶
MutateInt16 updates a Int16 at the given offset.
func (*Table) MutateInt16Slot ¶
MutateInt16Slot updates the int16 at given vtable location
func (*Table) MutateInt32 ¶
MutateInt32 updates a Int32 at the given offset.
func (*Table) MutateInt32Slot ¶
MutateInt32Slot updates the int32 at given vtable location
func (*Table) MutateInt64 ¶
MutateInt64 updates a Int64 at the given offset.
func (*Table) MutateInt64Slot ¶
MutateInt64Slot updates the int64 at given vtable location
func (*Table) MutateInt8 ¶
MutateInt8 updates a Int8 at the given offset.
func (*Table) MutateInt8Slot ¶
MutateInt8Slot updates the int8 at given vtable location
func (*Table) MutateSOffsetT ¶
MutateSOffsetT updates a SOffsetT at the given offset.
func (*Table) MutateUOffsetT ¶
MutateUOffsetT updates a UOffsetT at the given offset.
func (*Table) MutateUint16 ¶
MutateUint16 updates a Uint16 at the given offset.
func (*Table) MutateUint16Slot ¶
MutateUint16Slot updates the uint16 at given vtable location
func (*Table) MutateUint32 ¶
MutateUint32 updates a Uint32 at the given offset.
func (*Table) MutateUint32Slot ¶
MutateUint32Slot updates the uint32 at given vtable location
func (*Table) MutateUint64 ¶
MutateUint64 updates a Uint64 at the given offset.
func (*Table) MutateUint64Slot ¶
MutateUint64Slot updates the uint64 at given vtable location
func (*Table) MutateUint8 ¶
MutateUint8 updates a Uint8 at the given offset.
func (*Table) MutateUint8Slot ¶
MutateUint8Slot updates the uint8 at given vtable location
func (*Table) MutateVOffsetT ¶
MutateVOffsetT updates a VOffsetT at the given offset.
func (Table) NumFields ¶
NumFields returns the number of fields encoded in this table's vtable.
Does not include metadata fields, but only actual table fields.
func (*Table) Offset ¶
Offset provides access into the Table's vtable.
Fields which are deprecated are ignored by checking against the vtable's length.
func (*Table) Union ¶
Union initializes any Table-derived type to point to the union at the given offset.
type UOffsetT ¶
type UOffsetT uint32
A UOffsetT stores an unsigned offset into vector data.
func GetIndirectOffset ¶
GetIndirectOffset retrives the relative offset in the provided buffer stored at `offset`.
func GetUOffsetT ¶
GetUOffsetT decodes a little-endian UOffsetT from a byte slice.