Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Double = float64Type{ // contains filtered or unexported fields }
Double makes a type for float64 data, and tells the length of bytes it is made of.
var Enum = enumType{ // contains filtered or unexported fields }
Enum is the enum type
var Float = float32Type{ // contains filtered or unexported fields }
Float makes a type for float32 data, and tells the length of bytes it is made of.
var I16 = uint16Type{ // contains filtered or unexported fields }
I16 is the i16 type
var I32 = int32Type{ // contains filtered or unexported fields }
I32 is the i32 type
var I64 = int64Type{ // contains filtered or unexported fields }
I64 is the i64 type
var I8 = int8Type{ // contains filtered or unexported fields }
I8 is the i8 type
var Stringx = stringType{ // contains filtered or unexported fields }
Stringx is the string type
var U16 = uint16Type{ // contains filtered or unexported fields }
U16 is the u16 type
var U32 = uint32Type{ // contains filtered or unexported fields }
U32 is the u32 type.
var U64 = uint64Type{ // contains filtered or unexported fields }
U64 is the u64 type
var U8 = uint8Type{ // contains filtered or unexported fields }
U8 is the u8 type
Functions ¶
func InsertArgValueIntoStruct ¶
func InsertArgValueIntoStruct(argStruct interface{}, argValues []interface{}) error
InsertArgValueIntoStruct takes the struct to fill as a pointer value, and the arguments as a slice of []interface{} as input. It will use reflect to loop over the struct fields, and set the correct value for each field from the []argvalues. NB: The order of the []argvalues have to be the same as the order of the elements in the struct.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is a type for keeping track of the start position of the data to read in a slice.
func (*Decoder) DecodeArgs ¶
func (as *Decoder) DecodeArgs(argStruct interface{}, d []byte, a ...argDecoder) ([]interface{}, error)
DecodeArgs takes a []byte and any number of the interface type *argDecoder is input. It will loop through the argDecoder methods, and run the concrete types method, one by one until all methods are done. The method will use the getLength() method to know the size of the portion of data to work with, and increase the the position with the size of the last data read to know where the next piece of data starts. TODO: Make logic check if there are given the correct amount of argDecoders to handle the length of the data slice given as input, and return error if they don't match.