Documentation ¶
Index ¶
- Constants
- func Decode(r io.Reader, dst interface{}) error
- func Encode(w io.Writer, structs interface{}) error
- func EncodeAbi(contractName string, method string, w io.Writer, value interface{}, abi ABI, ...) error
- func EncodeAbiEx(contractName string, method string, w io.Writer, value map[string]interface{}, ...) error
- func Marshal(v interface{}) ([]byte, error)
- func MarshalAbi(v interface{}, Abi *ABI, contractName string, method string) ([]byte, error)
- func MarshalAbiEx(v map[string]interface{}, Abi *ABI, contractName string, method string) ([]byte, error)
- func PackArraySize(writer io.Writer, length uint16) (n int, err error)
- func PackBin16(writer io.Writer, value []byte) (n int, err error)
- func PackStr16(writer io.Writer, value string) (n int, err error)
- func PackUint16(writer io.Writer, value uint16) (n int, err error)
- func PackUint32(writer io.Writer, value uint32) (n int, err error)
- func PackUint64(writer io.Writer, value uint64) (n int, err error)
- func PackUint8(writer io.Writer, value uint8) (n int, err error)
- func Setmapval(structmap map[string]interface{}, key string, val interface{})
- func Unmarshal(data []byte, dst interface{}) error
- func UnpackArraySize(reader io.Reader) (size uint16, err error)
- func UnpackBin16(reader io.Reader) ([]byte, error)
- func UnpackStr16(reader io.Reader) (string, error)
- func UnpackUint16(reader io.Reader) (v uint16, err error)
- func UnpackUint32(reader io.Reader) (v uint32, err error)
- func UnpackUint64(reader io.Reader) (v uint64, err error)
- func UnpackUint8(reader io.Reader) (v uint8, err error)
- type ABI
- type ABIAction
- type ABIStruct
- type ABIStructs
- type ByIndex
- type ByPair
- type Bytes
- type Bytes1
- type Bytes2
- type Bytes4
- type Bytes8
- type FeildMap
- func (o *FeildMap) Delete(key string)
- func (o *FeildMap) Get(key string) (interface{}, bool)
- func (o *FeildMap) GetStringPair() []StringPair
- func (o *FeildMap) GetStringVal(key string) (string, bool)
- func (o *FeildMap) Keys() []string
- func (o FeildMap) MarshalJSON() ([]byte, error)
- func (o *FeildMap) Set(key string, value interface{})
- func (o *FeildMap) Sort(lessFunc func(a *Pair, b *Pair) bool)
- func (o *FeildMap) SortKeys(sortFunc func(keys []string))
- func (o *FeildMap) UnmarshalJSON(b []byte) error
- type KeyIndex
- type Pair
- type StringPair
Constants ¶
const ( //BIN16 is byte array type identifier BIN16 = 0xc5 //UINT8 is uint8 UINT8 = 0xcc //UINT16 is uint16 UINT16 = 0xcd //UINT32 is uint32 UINT32 = 0xce //UINT64 is uint64 UINT64 = 0xcf //STR16 is string type identifier STR16 = 0xda //ARRAY16 is array size type identifier ARRAY16 = 0xdc //LEN_INT32 value LEN_INT32 = 4 //LEN_INT64 value LEN_INT64 = 8 //MAX16BIT value MAX16BIT = 2 << (16 - 1) //REGULAR_UINT7_MAX value REGULAR_UINT7_MAX = 2 << (7 - 1) //REGULAR_UINT8_MAX value REGULAR_UINT8_MAX = 2 << (8 - 1) //REGULAR_UINT16_MAX value REGULAR_UINT16_MAX = 2 << (16 - 1) //REGULAR_UINT32_MAX value REGULAR_UINT32_MAX = 2 << (32 - 1) //SPECIAL_INT8 value SPECIAL_INT8 = 32 //SPECIAL_INT16 value SPECIAL_INT16 = 2 << (8 - 2) //SPECIAL_INT32 value SPECIAL_INT32 = 2 << (16 - 2) //SPECIAL_INT64 value SPECIAL_INT64 = 2 << (32 - 2) )
const ( //NEGFIXNUM is negfix maxnum NEGFIXNUM = 0xe0 //FIXMAPMAX is fixmap maxnum FIXMAPMAX = 0x8f //FIXARRAYMAX is fixarray maxnum FIXARRAYMAX = 0x9f //FIXRAWMAX is fix raw max FIXRAWMAX = 0xbf //FIRSTBYTEMASK is first byte mask FIRSTBYTEMASK = 0xf )
Variables ¶
This section is empty.
Functions ¶
func EncodeAbi ¶
func EncodeAbi(contractName string, method string, w io.Writer, value interface{}, abi ABI, subStructName string) error
EncodeAbi is to encode message
func EncodeAbiEx ¶
func EncodeAbiEx(contractName string, method string, w io.Writer, value map[string]interface{}, abi ABI, subStructName string) error
EncodeAbiEx is to encode message
func MarshalAbi ¶
MarshalAbi is to serialize the message
func MarshalAbiEx ¶
func MarshalAbiEx(v map[string]interface{}, Abi *ABI, contractName string, method string) ([]byte, error)
MarshalAbiEx is to serialize the message
func PackArraySize ¶
PackArraySize is to pack a given value and writes it into the specified writer.
func PackUint16 ¶
PackUint16 is to pack a given value and writes it into the specified writer.
func PackUint32 ¶
PackUint32 is to pack a given value and writes it into the specified writer.
func PackUint64 ¶
PackUint64 is to pack a given value and writes it into the specified writer.
func UnpackArraySize ¶
UnpackArraySize is to unpack message
func UnpackBin16 ¶
UnpackBin16 is to unpack message
func UnpackStr16 ¶
UnpackStr16 is to unpack message
func UnpackUint16 ¶
UnpackUint16 is to unpack message
func UnpackUint32 ¶
UnpackUint32 is to unpack message
func UnpackUint64 ¶
UnpackUint64 is to unpack message
Types ¶
type ABI ¶
type ABI struct { Types []interface{} `json:"types"` Structs []ABIStruct `json:"structs"` Actions []ABIAction `json:"actions"` Tables []interface{} `json:"tables"` }
ABI struct for abi
func GetAbibyContractName ¶
GetAbibyContractName function
type ABIStruct ¶
type ABIStruct struct { Name string `json:"name"` Base string `json:"base"` Fields *FeildMap `json:"fields"` }
ABIStruct parameter struct for abi Action(Method)
type ABIStructs ¶
type ABIStructs struct { Structs []struct { Name string `json:"name"` Base string `json:"base"` Fields map[string]string `json:"fields"` } `json:"structs"` }
ABIStructs structs for ABI
type FeildMap ¶
type FeildMap struct {
// contains filtered or unexported fields
}
FeildMap struct
func (*FeildMap) GetStringPair ¶
func (o *FeildMap) GetStringPair() []StringPair
GetStringPair get key value pairs
func (*FeildMap) GetStringVal ¶
GetStringVal get string value by key
func (*FeildMap) UnmarshalJSON ¶
UnmarshalJSON function