arguments

package
v0.0.0-...-9882766 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var Enum = enumType{
	// contains filtered or unexported fields
}

Enum is the enum type

View Source
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.

View Source
var I16 = uint16Type{
	// contains filtered or unexported fields
}

I16 is the i16 type

View Source
var I32 = int32Type{
	// contains filtered or unexported fields
}

I32 is the i32 type

View Source
var I64 = int64Type{
	// contains filtered or unexported fields
}

I64 is the i64 type

View Source
var I8 = int8Type{
	// contains filtered or unexported fields
}

I8 is the i8 type

View Source
var Stringx = stringType{
	// contains filtered or unexported fields
}

Stringx is the string type

View Source
var U16 = uint16Type{
	// contains filtered or unexported fields
}

U16 is the u16 type

View Source
var U32 = uint32Type{
	// contains filtered or unexported fields
}

U32 is the u32 type.

View Source
var U64 = uint64Type{
	// contains filtered or unexported fields
}

U64 is the u64 type

View Source
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 NewDecoder

func NewDecoder() *Decoder

NewDecoder will return a new argument decoder type.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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