Documentation
¶
Index ¶
- type Buffer
- func (b *Buffer) Get(name string) interface{}
- func (b *Buffer) GetBool(name string) (bool, bool)
- func (b *Buffer) GetByte(name string) (byte, bool)
- func (b *Buffer) GetDouble(name string) (float64, bool)
- func (b *Buffer) GetFloat(name string) (float32, bool)
- func (b *Buffer) GetInt(name string) (int32, bool)
- func (b *Buffer) GetLong(name string) (int64, bool)
- func (b *Buffer) GetString(name string) (string, bool)
- func (b *Buffer) Set(name string, value interface{})
- func (b *Buffer) ToBytes() []byte
- func (b *Buffer) ToJSON() string
- type FieldType
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is wrapper for FlatBuffers
func ReadBuffer ¶
ReadBuffer creates Buffer from bytes using provided Schema
func (*Buffer) Get ¶
Get returns stored field value by name. nil -> field is unset or no such field in the schema
func (*Buffer) GetBool ¶
GetBool returns bool value by name and if the schema contains the field and if the value was set to non-nil
func (*Buffer) GetByte ¶
GetByte returns byte value by name and if the schema contains the field and if the value was set to non-nil
func (*Buffer) GetDouble ¶
GetDouble returns float64 value by name and if the schema contains the field and if the value was set to non-nil
func (*Buffer) GetFloat ¶
GetFloat returns float32 value by name and if the schema contains the field and if the value was set to non-nil
func (*Buffer) GetInt ¶
GetInt returns int32 value by name and if the schema contains the field and the value was set to non-nil
func (*Buffer) GetLong ¶
GetLong returns int64 value by name and if the schema contains the field and if the value was set to non-nil
func (*Buffer) GetString ¶
GetString returns string value by name and if the schema contains the field and if the value was set to non-nil
func (*Buffer) Set ¶
Set sets field value by name. Byte array is not modified. Call ToBytes() to get modified byte array
type FieldType ¶
type FieldType int
FieldType s.e.
const ( // FieldTypeUnspecified - wrong type FieldTypeUnspecified FieldType = iota // FieldTypeInt int32 FieldTypeInt // FieldTypeLong int64 FieldTypeLong // FieldTypeFloat float32 FieldTypeFloat // FieldTypeDouble float64 FieldTypeDouble // FieldTypeString variable length FieldTypeString // FieldTypeBool s.e. FieldTypeBool // FieldTypeByte byte FieldTypeByte )
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema s.e.
func YamlToSchema ¶
YamlToSchema creates Schema by provided yaml `fieldName: yamlFieldType`
Field types:
- `int` -> `int32`
- `long` -> `int64`
- `float` -> `float32`
- `double` -> `float64`
- `bool` -> `bool`
- `string` -> `string`
- `byte` -> `byte`
See [dynobuffers_test.go](dynobuffers_test.go) for examples