syllab

package
v0.0.0-...-4a740ba Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSyllabNeededTypeNotExist = errorr.New().SetDetail(lang.EnglishLanguage, "Syllab - Needed Type Not Exist",
		"Custom struct type exist in upper struct type that generator can't access it to know its fields").Save()

	ErrSyllabFieldType = errorr.New().SetDetail(lang.EnglishLanguage, "Syllab - Field Type",
		"Requested type may include function, interface, int, uint, ... field type that can't encode||decode").Save()

	ErrSyllabArrayLen = errorr.New().SetDetail(lang.EnglishLanguage, "Syllab - Array Len",
		"Length of array larger than 32 bit space that syllab can encode||decode").Save()

	ErrSyllabDecodeSmallSlice = errorr.New().SetDetail(lang.EnglishLanguage, "Syllab - Decode Small Slice",
		"Given slice smaller than expected to decode data from it").Save()

	ErrSyllabDecodeHeapOverFlow = errorr.New().SetDetail(lang.EnglishLanguage, "Syllab - Decode Heap OverFlow",
		"Encoded syllab want to access to out of slice.").Save()
)

Declare Errors Details

Functions

func CompleteMethods

func CompleteMethods(file *assets.File, gos *GenerationOptions) (err error)

CompleteMethods use to update given go files and complete Syllab encoder&&decoder to any struct type in it! It will overwrite given file methods! If you need it clone it before pass it here!

func GetBool

func GetBool(p []byte, stackIndex uint32) bool

GetBool decodes BOOL from the payload buffer.

func GetBoolArray

func GetBoolArray(p []byte, stackIndex uint32) (slice []bool)

GetBoolArray decodes bool array from the payload buffer!

func GetByte

func GetByte(p []byte, stackIndex uint32) byte

GetByte decodes BYTE from the payload buffer.

func GetByteArray

func GetByteArray(p []byte, stackIndex uint32) (slice []byte)

GetByteArray decodes byte||uint8 array from the payload buffer!

func GetComplex128

func GetComplex128(p []byte, stackIndex uint32) complex128

GetComplex128 decodes COMPLEX128 from the payload buffer.

func GetComplex128Array

func GetComplex128Array(p []byte, stackIndex uint32) (slice []complex128)

GetComplex128Array decode fixed size Complex128 array from the payload buffer

func GetComplex64

func GetComplex64(p []byte, stackIndex uint32) complex64

GetComplex64 decodes COMPLEX64 from the payload buffer.

func GetComplex64Array

func GetComplex64Array(p []byte, stackIndex uint32) (slice []complex64)

GetComplex64Array decode fixed size Complex64 array from the payload buffer

func GetFixedByteArray

func GetFixedByteArray(p []byte, stackIndex uint32, n uint32) (array []byte)

GetFixedByteArray decodes fixed sized byte array from the payload buffer. If you want array instead of slice from function below, You can copy function and edit it for your usage! e.g. for get a [2]byte ```var array [2]byte = copy(array[:], p[stackIndex:])``` for get a [32]byte ```var array [32]byte = copy(array[:], p[stackIndex:])```

func GetFloat32

func GetFloat32(p []byte, stackIndex uint32) float32

GetFloat32 decodes FLOAT32 from the payload buffer.

func GetFloat32Array

func GetFloat32Array(p []byte, stackIndex uint32) (slice []float32)

GetFloat32Array decode fixed size Float32 array from the payload buffer

func GetFloat64

func GetFloat64(p []byte, stackIndex uint32) float64

GetFloat64 decodes FLOAT64 from the payload buffer.

func GetFloat64Array

func GetFloat64Array(p []byte, stackIndex uint32) (slice []float64)

GetFloat64Array decode fixed size Float64 array from the payload buffer

func GetInt16

func GetInt16(p []byte, stackIndex uint32) int16

GetInt16 decodes INT16 from the payload buffer.

func GetInt16Array

func GetInt16Array(p []byte, stackIndex uint32) (slice []int16)

GetInt16Array decode Int16 array from the payload buffer

func GetInt32

func GetInt32(p []byte, stackIndex uint32) int32

GetInt32 decodes INT32 from the payload buffer.

func GetInt32Array

func GetInt32Array(p []byte, stackIndex uint32) (slice []int32)

GetInt32Array decode fixed size Int32 array from the payload buffer

func GetInt64

func GetInt64(p []byte, stackIndex uint32) int64

GetInt64 decodes INT64 from the payload buffer.

func GetInt64Array

func GetInt64Array(p []byte, stackIndex uint32) (slice []int64)

GetInt64Array decode fixed size Int64 array from the payload buffer

func GetInt8

func GetInt8(p []byte, stackIndex uint32) int8

GetInt8 decodes INT8 from the payload buffer.

func GetInt8Array

func GetInt8Array(p []byte, stackIndex uint32) (slice []int8)

GetInt8Array decodes int8 array from the payload buffer!

func GetString

func GetString(p []byte, stackIndex uint32) string

GetString decodes string from the payload buffer!

func GetStringArray

func GetStringArray(p []byte, stackIndex uint32) (slice []string)

GetStringArray encode string array to the payload buffer!

func GetUInt16

func GetUInt16(p []byte, stackIndex uint32) uint16

GetUInt16 decodes UINT16 from the payload buffer.

func GetUInt16Array

func GetUInt16Array(p []byte, stackIndex uint32) (slice []uint16)

GetUInt16Array decode UInt16 array from the payload buffer

func GetUInt32

func GetUInt32(p []byte, stackIndex uint32) uint32

GetUInt32 decodes UINT32 from the payload buffer.

func GetUInt32Array

func GetUInt32Array(p []byte, stackIndex uint32) (slice []uint32)

GetUInt32Array decode fixed size UInt32 array from the payload buffer

func GetUInt64

func GetUInt64(p []byte, stackIndex uint32) uint64

GetUInt64 decodes UINT64 from the payload buffer.

func GetUInt64Array

func GetUInt64Array(p []byte, stackIndex uint32) (slice []uint64)

GetUInt64Array decode fixed size UInt64 array from the payload buffer

func GetUInt8

func GetUInt8(p []byte, stackIndex uint32) uint8

GetUInt8 decodes UINT8 from the payload buffer.

func Marshal

func Marshal(s interface{}, offset int) (p []byte, err error)

Marshal encodes the value of s to the payload buffer in runtime. offset add free space by given number at begging of return slice that almost just use in sRPC protocol! It can be 0!!

func SetArray

func SetArray(p []byte, stackIndex uint32, a []byte)

SetArray encode fixed sized byte array to the payload buffer.

func SetBool

func SetBool(p []byte, stackIndex uint32, b bool)

SetBool encode BOOL to the payload buffer.

func SetBoolArray

func SetBoolArray(p []byte, s []bool, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetBoolArray encode bool array to the payload buffer!

func SetByte

func SetByte(p []byte, stackIndex uint32, b byte)

SetByte encode BYTE to the payload buffer.

func SetByteArray

func SetByteArray(p []byte, s []byte, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetByteArray encode byte array || uint8 array to the payload buffer!

func SetComplex128

func SetComplex128(p []byte, stackIndex uint32, n complex128)

SetComplex128 encode COMPLEX128 to the payload buffer.

func SetComplex128Array

func SetComplex128Array(p []byte, s []complex128, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetComplex128Array encode complex128 array to the payload buffer!

func SetComplex64

func SetComplex64(p []byte, stackIndex uint32, n complex64)

SetComplex64 encode COMPLEX64 to the payload buffer.

func SetComplex64Array

func SetComplex64Array(p []byte, s []complex64, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetComplex64Array encode complex64 array to the payload buffer!

func SetFloat32

func SetFloat32(p []byte, stackIndex uint32, n float32)

SetFloat32 encode FLOAT32 to the payload buffer.

func SetFloat32Array

func SetFloat32Array(p []byte, s []float32, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetFloat32Array encode float32 array to the payload buffer!

func SetFloat64

func SetFloat64(p []byte, stackIndex uint32, n float64)

SetFloat64 encode FLOAT64 to the payload buffer.

func SetFloat64Array

func SetFloat64Array(p []byte, s []float64, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetFloat64Array encode float64 array to the payload buffer!

func SetInt16

func SetInt16(p []byte, stackIndex uint32, n int16)

SetInt16 encode INT16 to the payload buffer.

func SetInt16Array

func SetInt16Array(p []byte, s []int16, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetInt16Array encode int16 array to the payload buffer!

func SetInt32

func SetInt32(p []byte, stackIndex uint32, n int32)

SetInt32 encode INT32 to the payload buffer.

func SetInt32Array

func SetInt32Array(p []byte, s []int32, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetInt32Array encode int32 array to the payload buffer!

func SetInt64

func SetInt64(p []byte, stackIndex uint32, n int64)

SetInt64 encode INT64 to the payload buffer.

func SetInt64Array

func SetInt64Array(p []byte, s []int64, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetInt64Array encode int64 array to the payload buffer!

func SetInt8

func SetInt8(p []byte, stackIndex uint32, n int8)

SetInt8 encode INT8 to the payload buffer.

func SetInt8Array

func SetInt8Array(p []byte, s []int8, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetInt8Array encode int8 array to the payload buffer!

func SetString

func SetString(p []byte, s string, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetString encode string to the payload buffer!

func SetStringArray

func SetStringArray(p []byte, s []string, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetStringArray encode string array to the payload buffer!

func SetUInt16

func SetUInt16(p []byte, stackIndex uint32, n uint16)

SetUInt16 encode UINT16 to the payload buffer.

func SetUInt16Array

func SetUInt16Array(p []byte, s []uint16, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetUInt16Array encode uint16 array to the payload buffer!

func SetUInt32

func SetUInt32(p []byte, stackIndex uint32, n uint32)

SetUInt32 encode UINT32 to the payload buffer.

func SetUInt32Array

func SetUInt32Array(p []byte, s []uint32, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetUInt32Array encode uint32 array to the payload buffer!

func SetUInt64

func SetUInt64(p []byte, stackIndex uint32, n uint64)

SetUInt64 encode UINT64 to the payload buffer.

func SetUInt64Array

func SetUInt64Array(p []byte, s []uint64, stackIndex uint32, heapAddr uint32) (nextHeapAddr uint32)

SetUInt64Array encode uint64 array to the payload buffer!

func SetUInt8

func SetUInt8(p []byte, stackIndex uint32, n uint8)

SetUInt8 encode UINT8 to the payload buffer.

func UnMarshal

func UnMarshal(p []byte, s interface{}) (err error)

UnMarshal decode payload and stores the result in the value pointed to by s in runtime.

func UnsafeGetBoolArray

func UnsafeGetBoolArray(p []byte, stackIndex uint32) (slice []bool)

UnsafeGetBoolArray decodes bool array from the payload buffer!

func UnsafeGetByteArray

func UnsafeGetByteArray(p []byte, stackIndex uint32) []byte

UnsafeGetByteArray decodes byte slice from the payload buffer in unsafe manner!

func UnsafeGetComplex128Array

func UnsafeGetComplex128Array(p []byte, stackIndex uint32) (slice []complex128)

UnsafeGetComplex128Array decode fixed size Complex128 array from the payload buffer

func UnsafeGetComplex64Array

func UnsafeGetComplex64Array(p []byte, stackIndex uint32) (slice []complex64)

UnsafeGetComplex64Array decode fixed size Complex64 array from the payload buffer

func UnsafeGetFloat32Array

func UnsafeGetFloat32Array(p []byte, stackIndex uint32) (slice []float32)

UnsafeGetFloat32Array decode fixed size Float32 array from the payload buffer

func UnsafeGetFloat64Array

func UnsafeGetFloat64Array(p []byte, stackIndex uint32) (slice []float64)

UnsafeGetFloat64Array decode fixed size Float64 array from the payload buffer

func UnsafeGetInt16Array

func UnsafeGetInt16Array(p []byte, stackIndex uint32) (slice []int16)

UnsafeGetInt16Array decode Int16 array from the payload buffer

func UnsafeGetInt32Array

func UnsafeGetInt32Array(p []byte, stackIndex uint32) (slice []int32)

UnsafeGetInt32Array decode fixed size Int32 array from the payload buffer

func UnsafeGetInt64Array

func UnsafeGetInt64Array(p []byte, stackIndex uint32) (slice []int64)

UnsafeGetInt64Array decode fixed size Int64 array from the payload buffer

func UnsafeGetInt8Array

func UnsafeGetInt8Array(p []byte, stackIndex uint32) []int8

UnsafeGetInt8Array decodes int8 slice from the payload buffer in unsafe manner!

func UnsafeGetString

func UnsafeGetString(p []byte, stackIndex uint32) string

UnsafeGetString decodes string from the payload buffer in unsafe manner!

func UnsafeGetStringArray

func UnsafeGetStringArray(p []byte, stackIndex uint32) (slice []string)

UnsafeGetStringArray encode string array to the payload buffer!

func UnsafeGetUInt16Array

func UnsafeGetUInt16Array(p []byte, stackIndex uint32) (slice []uint16)

UnsafeGetUInt16Array decode UInt16 array from the payload buffer

func UnsafeGetUInt32Array

func UnsafeGetUInt32Array(p []byte, stackIndex uint32) (slice []uint32)

UnsafeGetUInt32Array decode fixed size UInt32 array from the payload buffer

func UnsafeGetUInt64Array

func UnsafeGetUInt64Array(p []byte, stackIndex uint32) (slice []uint64)

UnsafeGetUInt64Array decode fixed size UInt64 array from the payload buffer

Types

type GenerationOptions

type GenerationOptions struct {
	UnSafe      bool // true means don't copy data from given payload||buffer and just point to it for decoding fields! buffer can't GC until decoded struct free!
	ForceUpdate bool // true means delete exiting codes and update encoders && decoders codes anyway!
}

GenerationOptions indicate generator behavior!

Jump to

Keyboard shortcuts

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