Documentation
¶
Index ¶
- Constants
- func Add16ToSlice(number uint16, slice *[]byte) *[]byte
- func Add32ToSlice(number uint32, slice *[]byte) *[]byte
- func Add64ToSlice(number uint64, slice *[]byte) *[]byte
- func EncodeUnit(unit *FilledUnit) (*[]byte, error)
- func SliceToU16(slice []byte) uint16
- func SliceToU32(slice []byte) uint32
- func SliceToU64(slice []byte) uint64
- func UserEncode(u UserFacingHermodUnit) (*[]byte, error)
- type BigInteger
- type BigSignedInteger
- type Boolean
- type Field
- type FieldValue
- type FilledUnit
- type Integer
- type SignedInteger
- type SmallInteger
- type SmallSignedInteger
- type String
- type TinyInteger
- type TinySignedInteger
- type Unit
- type UserFacingHermodUnit
Constants ¶
View Source
const False = Boolean(0x00)
View Source
const True = Boolean(0xff)
Variables ¶
This section is empty.
Functions ¶
func Add16ToSlice ¶ added in v0.2.0
func Add32ToSlice ¶ added in v0.2.0
func Add64ToSlice ¶ added in v0.2.0
func EncodeUnit ¶
func EncodeUnit(unit *FilledUnit) (*[]byte, error)
EncodeUnit converts a Unit into a Hermod-encoded byte slice. [2 bytes transmission ID] then for each field value: [2 bytes field ID] [4 bytes content length in bytes (n)] [n bytes content]
func SliceToU16 ¶ added in v0.2.0
func SliceToU32 ¶ added in v0.2.0
func SliceToU64 ¶ added in v0.2.0
func UserEncode ¶
func UserEncode(u UserFacingHermodUnit) (*[]byte, error)
Types ¶
type BigInteger ¶
type BigInteger uint64
type BigSignedInteger ¶
type BigSignedInteger int64
type FieldValue ¶
type FieldValue struct { ParentUnit *FilledUnit Value interface{} }
type FilledUnit ¶
type FilledUnit struct { *Unit Values map[Field]FieldValue }
func DecodeUnit ¶
func DecodeUnit(_rawUnit *[]byte, unit Unit) (*FilledUnit, error)
DecodeUnit attempts (blindly) to decode a Hermod-encoded byte slice into a FilledUnit Errors are returned only for content issues. Structural issues may cause unexpected behaviour, panics, or even infinite loops!
func UserToFilledUnit ¶
func UserToFilledUnit(u UserFacingHermodUnit) (*FilledUnit, error)
type SignedInteger ¶
type SignedInteger int32
type SmallInteger ¶
type SmallInteger uint16
type SmallSignedInteger ¶
type SmallSignedInteger int16
type TinyInteger ¶
type TinyInteger uint8
type TinySignedInteger ¶
type TinySignedInteger int8
type UserFacingHermodUnit ¶
type UserFacingHermodUnit interface { GetDefinition() *Unit DecodeAbstract(data *[]byte) (UserFacingHermodUnit, error) }
func FilledUnitToUser ¶
func FilledUnitToUser(filledUnit *FilledUnit, u UserFacingHermodUnit) (UserFacingHermodUnit, error)
func UserDecode ¶
func UserDecode(u UserFacingHermodUnit, data *[]byte) (UserFacingHermodUnit, error)
Click to show internal directories.
Click to hide internal directories.