serializer

package
v0.0.0-...-61197bd Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//STInt8 初始化
	STInt8 = new(SerializedInt8)
	//STInt16 初始化
	STInt16 = new(SerializedInt16)
	//STInt32 初始化
	STInt32 = new(SerializedInt32)
	//STInt64 初始化
	STInt64 = new(SerializedInt64)
	//STMemo 初始化
	STMemo = new(SerializedMemo)
	//STArg 初始化
	STArg = new(SerializedArg)
	//STHash256 初始化
	STHash256 = new(SerializedHash256)
	//STObject 初始化
	STObject = new(SerializedObject)
)
View Source
var (

	//ConfigCurrencty 配置的货币
	ConfigCurrencty string
)

Functions

func Serialize

func Serialize(so *Serializer, fieldName string, value interface{})

Serialize 序列化属性

func SerializeHex

func SerializeHex(so *Serializer, val string, noLength bool)

SerializeHex 16进制序列化

func SerializeVarint

func SerializeVarint(so *Serializer, val uint)

SerializeVarint int序列化。

Types

type ISerializedType

type ISerializedType interface {
	Serialize(so *Serializer, val interface{}, noMarker bool)
	Parse(so *Serializer) interface{}
}

ISerializedType 是一个序列化接口。

type MemoDataInfo

type MemoDataInfo struct {
	MemoData   string
	MemoFormat string
	MemoType   string
}

MemoDataInfo 备注

type MemoInfo

type MemoInfo struct {
	Memo *MemoDataInfo
}

MemoInfo 备注

type PathComputed

type PathComputed struct {
	Currency string `json:"currency"`
	Issuer   string `json:"issuer"`
	Value    string `json:"value"`
	Account  string `json:"account"`
	Type     int    `json:"type"`
	TypeHex  string `json:"type_hex"`
}

PathComputed 结构体。

type PathData

type PathData struct {
	PathsComputed [][]PathComputed
	Choice        interface{}
}

PathData 结构体。

type SerializedAccount

type SerializedAccount struct {
}

SerializedAccount account

func (SerializedAccount) Parse

func (serAccount SerializedAccount) Parse(so *Serializer) interface{}

Parse 账号反序列化。

func (SerializedAccount) Serialize

func (serAccount SerializedAccount) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize 账号序列化。

type SerializedAmount

type SerializedAmount struct {
}

SerializedAmount amount

func (SerializedAmount) Parse

func (serAmount SerializedAmount) Parse(so *Serializer) interface{}

Parse 金额反序列化。

func (SerializedAmount) Serialize

func (serAmount SerializedAmount) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize 金额序列化。

type SerializedArg

type SerializedArg struct {
}

SerializedArg args

func (SerializedArg) Parse

func (serArg SerializedArg) Parse(so *Serializer) interface{}

Parse arg

func (SerializedArg) Serialize

func (serArg SerializedArg) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize arg

type SerializedArray

type SerializedArray struct {
}

SerializedArray array

func (SerializedArray) Parse

func (serArray SerializedArray) Parse(so *Serializer) interface{}

Parse array

func (SerializedArray) Serialize

func (serArray SerializedArray) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize array

type SerializedCurrency

type SerializedCurrency struct {
}

SerializedCurrency currency

func (SerializedCurrency) Parse

func (serCurrency SerializedCurrency) Parse(so *Serializer) interface{}

Parse currency

func (SerializedCurrency) Serialize

func (serCurrency SerializedCurrency) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize currency

type SerializedHash128

type SerializedHash128 struct {
}

SerializedHash128 hash 128

func (SerializedHash128) Parse

func (serHash128 SerializedHash128) Parse(so *Serializer) interface{}

Parse Hash128反序列化。

func (SerializedHash128) Serialize

func (serHash128 SerializedHash128) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize Hash128序列化。

type SerializedHash160

type SerializedHash160 struct {
}

SerializedHash160 hash 160

func (SerializedHash160) Parse

func (serHash160 SerializedHash160) Parse(so *Serializer) interface{}

Parse hash 160

func (SerializedHash160) Serialize

func (serHash160 SerializedHash160) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize hash 160

type SerializedHash256

type SerializedHash256 struct {
}

SerializedHash256 hash 256

func (SerializedHash256) Parse

func (serHash256 SerializedHash256) Parse(so *Serializer) interface{}

Parse Hash256反序列化。

func (SerializedHash256) Serialize

func (serHash256 SerializedHash256) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize Hash256序列化。

type SerializedInt16

type SerializedInt16 struct {
}

SerializedInt16 int16

func (SerializedInt16) Parse

func (serInt16 SerializedInt16) Parse(so *Serializer) interface{}

Parse int16

func (SerializedInt16) Serialize

func (serInt16 SerializedInt16) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize int16

type SerializedInt32

type SerializedInt32 struct {
}

SerializedInt32 int32

func (SerializedInt32) Parse

func (serInt32 SerializedInt32) Parse(so *Serializer) interface{}

Parse int32

func (SerializedInt32) Serialize

func (serInt32 SerializedInt32) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize int32

type SerializedInt64

type SerializedInt64 struct {
}

SerializedInt64 int64

func (SerializedInt64) Parse

func (serInt64 SerializedInt64) Parse(so *Serializer) interface{}

Parse int64

func (SerializedInt64) Serialize

func (serInt64 SerializedInt64) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize int64

type SerializedInt8

type SerializedInt8 struct {
}

SerializedInt8 int8

func (SerializedInt8) Parse

func (serInt8 SerializedInt8) Parse(so *Serializer) interface{}

Parse int8

func (SerializedInt8) Serialize

func (serInt8 SerializedInt8) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize int8

type SerializedMemo

type SerializedMemo struct {
}

SerializedMemo memo

func (SerializedMemo) Parse

func (serMemo SerializedMemo) Parse(so *Serializer) interface{}

Parse memo

func (SerializedMemo) Serialize

func (serMemo SerializedMemo) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize memo

type SerializedObject

type SerializedObject struct {
}

SerializedObject object

func (SerializedObject) Parse

func (serObject SerializedObject) Parse(so *Serializer) interface{}

Parse object

func (SerializedObject) Serialize

func (serObject SerializedObject) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize object

type SerializedPathSet

type SerializedPathSet struct {
}

SerializedPathSet pathset

func (SerializedPathSet) Parse

func (serPathSet SerializedPathSet) Parse(so *Serializer) interface{}

Parse path set

func (SerializedPathSet) Serialize

func (serPathSet SerializedPathSet) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize path set

type SerializedVariableLength

type SerializedVariableLength struct {
}

SerializedVariableLength variable length

func (SerializedVariableLength) Parse

func (serVL SerializedVariableLength) Parse(so *Serializer) interface{}

Parse variable length 反序列化。

func (SerializedVariableLength) Serialize

func (serVL SerializedVariableLength) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize variable length 序列化。

type SerializedVector256

type SerializedVector256 struct {
}

SerializedVector256 vector 256

func (SerializedVector256) Parse

func (serVector256 SerializedVector256) Parse(so *Serializer) interface{}

Parse Vector 256 反序列化。

func (SerializedVector256) Serialize

func (serVector256 SerializedVector256) Serialize(so *Serializer, val interface{}, noMarker bool)

Serialize Vector 256 序列化。

type Serializer

type Serializer struct {
	Buffer []byte
	// contains filtered or unexported fields
}

Serializer struct

func FromJSON

func FromJSON(txData map[string]interface{}) (*Serializer, error)

FromJSON 交易数据序列化。

func (*Serializer) Append

func (so *Serializer) Append(v []byte)

Append Buffer append

func (*Serializer) Hash

func (so *Serializer) Hash(prefix uint32) []byte

Hash 序列化哈希。

func (*Serializer) Serialize

func (so *Serializer) Serialize(typedef [][]interface{}, txData map[string]interface{})

Serialize Object 序列化。

func (*Serializer) ToHex

func (so *Serializer) ToHex() string

ToHex 序列化转 16 进制。

type TumAmount

type TumAmount struct {
	Currency   string
	Issuer     string
	Value      *big.Int
	IsNative   bool
	IsNegative bool
	IsZero     bool
	IsPositive bool
	Offset     int
}

TumAmount 金额结构体。

func NewTumAmount

func NewTumAmount() *TumAmount

NewTumAmount 初始化金额结构体。

func (*TumAmount) IsPositiveM

func (amount *TumAmount) IsPositiveM() bool

IsPositiveM IsPositiveM

func (*TumAmount) IsValid

func (amount *TumAmount) IsValid() bool

IsValid 金额合法验证

func (*TumAmount) IsZeroM

func (amount *TumAmount) IsZeroM() bool

IsZeroM 零值判断。

func (*TumAmount) TumToBytes

func (amount *TumAmount) TumToBytes() ([]byte, error)

TumToBytes 金额转字节

Jump to

Keyboard shortcuts

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