Documentation
¶
Index ¶
- func HandleError(r any, err *error)
- func IsNil(src unsafe.Pointer, lim unsafe.Pointer) (bool, unsafe.Pointer)
- func TakeBinHeader(src unsafe.Pointer, lim unsafe.Pointer) (int, unsafe.Pointer)
- func TakeBool(src unsafe.Pointer, lim unsafe.Pointer) (bool, unsafe.Pointer)
- func TakeBytes(src unsafe.Pointer, lim unsafe.Pointer, sBuf *SafeBuffer) ([]byte, unsafe.Pointer)
- func TakeFloat32(src unsafe.Pointer, lim unsafe.Pointer) (float32, unsafe.Pointer)
- func TakeFloat64(src unsafe.Pointer, lim unsafe.Pointer) (float64, unsafe.Pointer)
- func TakeInt(src unsafe.Pointer, lim unsafe.Pointer) (int, unsafe.Pointer)
- func TakeInt8(src unsafe.Pointer, lim unsafe.Pointer) (int8, unsafe.Pointer)
- func TakeInt16(src unsafe.Pointer, lim unsafe.Pointer) (int16, unsafe.Pointer)
- func TakeInt32(src unsafe.Pointer, lim unsafe.Pointer) (int32, unsafe.Pointer)
- func TakeInt64(src unsafe.Pointer, lim unsafe.Pointer) (int64, unsafe.Pointer)
- func TakeMapHeader(src unsafe.Pointer, lim unsafe.Pointer) (int, unsafe.Pointer)
- func TakeSliceHeader(src unsafe.Pointer, lim unsafe.Pointer) (int, unsafe.Pointer)
- func TakeStrHeader(src unsafe.Pointer, lim unsafe.Pointer) (int, unsafe.Pointer)
- func TakeString(src unsafe.Pointer, lim unsafe.Pointer, sBuf *SafeBuffer) (string, unsafe.Pointer)
- func TakeStringZC(src unsafe.Pointer, lim unsafe.Pointer) (string, unsafe.Pointer)
- func TakeUint(src unsafe.Pointer, lim unsafe.Pointer) (uint, unsafe.Pointer)
- func TakeUint8(src unsafe.Pointer, lim unsafe.Pointer) (uint8, unsafe.Pointer)
- func TakeUint16(src unsafe.Pointer, lim unsafe.Pointer) (uint16, unsafe.Pointer)
- func TakeUint32(src unsafe.Pointer, lim unsafe.Pointer) (uint32, unsafe.Pointer)
- func TakeUint64(src unsafe.Pointer, lim unsafe.Pointer) (uint64, unsafe.Pointer)
- type ErrorCode
- type SafeBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶ added in v0.0.2
func IsNil ¶ added in v0.0.2
IsNil checks if the current Msgpack value is nil (marker 0xc0). If it is nil, it returns true and shifts the pointer by 1 byte. If it is not nil, it returns false and the original untouched pointer.
func TakeBinHeader ¶
TakeBinHeader reads Binary header of Msgpack ([]byte data). Returns the size of the slice in bytes and updated pointer.
func TakeBool ¶
TakeBool reads a boolean value from Msgpack. Returns the boolean value and an updated pointer.
func TakeBytes ¶
TakeBytes reads a byte slice from Msgpack, copies its content into the SafeBuffer, and returns a long-lived []byte that safely survives the temporary Tarantool buffer.
func TakeFloat32 ¶
TakeFloat32 reads numeric value into float32.
func TakeFloat64 ¶
TakeFloat64 reads numeric value into float64.
func TakeMapHeader ¶
TakeMapHeader read Map header of Msgpack. Returns a number of elements (key-value pairs) in there and updated pointer.
func TakeSliceHeader ¶
TakeSliceHeader read Array header of Msgpack. Returns a number of elements in there and updated pointer.
func TakeStrHeader ¶
TakeStrHeader reads String header of Msgpack. Returns the size of the string in bytes and updated pointer.
func TakeString ¶
TakeString reads a string from Msgpack, copies its content into the SafeBuffer, and returns a long-lived string that safely survives the temporary Tarantool buffer.
func TakeStringZC ¶ added in v0.0.2
TakeStringZC reads a string from Msgpack using Zero-Copy. The returned string points directly into the incoming 'src' memory buffer. WARNING: The string is only valid as long as the underlying source buffer is not cleared or reused.
func TakeUint16 ¶
TakeUint16 reads numeric value uinto uint16.
func TakeUint32 ¶
TakeUint32 reads numeric value uinto uint32.
Types ¶
type ErrorCode ¶
type ErrorCode int
const ( ErrorSliceExhausted ErrorCode = iota ErrorSliceHeaderTruncated ErrorSliceHeaderCorrupted ErrorMapExhausted ErrorMapHeaderTruncated ErrorMapHeaderCorrupted ErrorStrExhausted ErrorStrHeaderTruncated ErrorStrHeaderCorrupted ErrorStrLenConflict ErrorBinExhausted ErrorBinHeaderTruncated ErrorBinHeaderCorrupted ErrorBinLenConflict ErrorNumberExhausted ErrorNumberTruncated ErrorIntCorrupted ErrorUintCorrupted ErrorFloatCorrupted ErrorIntOverflow ErrorUintOverflow ErrorBoolExhausted ErrorBoolCorrupted ErrorStructExhausted ErrorStructCorrupted ErrorUnknownField ErrorRequiredFieldMissing )
type SafeBuffer ¶
type SafeBuffer struct {
// contains filtered or unexported fields
}
SafeBuffer buffer for safe storage of strings and bytes for msgpack data from temporary buffer.
func NewSafeBuffer ¶
func NewSafeBuffer(bufCap int) *SafeBuffer
NewSafeBuffer creates safe buffer with preallocated bytes. Beware, you better not to use anything larger than 512 unless you are going to reuse it. And you better to make it smaller than 512 at that: the smaller the size the easier is to alloc.
func (*SafeBuffer) AllocBytes ¶
func (b *SafeBuffer) AllocBytes(data unsafe.Pointer, size int) []byte
AllocBytes safely stores data referenced with pointer and the size as a []byte.
func (*SafeBuffer) AllocString ¶
func (b *SafeBuffer) AllocString(data unsafe.Pointer, size int) string
AllocString safely stores data referenced with pointer and the size as a string.