Documentation ¶
Overview ¶
Package convert for transforming between json serialized []byte and go structs
Index ¶
- Constants
- Variables
- func ArgsToBytes(iargs ...interface{}) (aa [][]byte, err error)
- func FromBytes(bb []byte, target interface{}) (result interface{}, err error)
- func FromBytesToStruct(bb []byte, target interface{}) (result interface{}, err error)
- func FromResponse(response peer.Response, target interface{}) (result interface{}, err error)
- func TimestampToTime(ts *timestamp.Timestamp) time.Time
- func ToBytes(value interface{}) ([]byte, error)
- func UnmarshallPtr(bb []byte, to interface{}) (result interface{}, err error)
- type FromByter
- type ToByter
Constants ¶
View Source
const TypeBool = true
View Source
const TypeInt = 1
View Source
const TypeString = ``
Variables ¶
View Source
var ( // ErrUnableToConvertNilToStruct - nil cannot be converted to struct ErrUnableToConvertNilToStruct = errors.New(`unable to convert nil to [struct,array,slice,ptr]`) // ErrUnableToConvertValueToStruct - value cannot be converted to struct ErrUnableToConvertValueToStruct = errors.New(`unable to convert value to [struct,array,slice,ptr]`) )
Functions ¶
func ArgsToBytes ¶
ArgsToBytes converts func arguments to bytes
func FromBytesToStruct ¶
FromBytesToStruct converts []byte to struct,array,slice depending on target type
func FromResponse ¶
FromResponse converts response.Payload to target
func TimestampToTime ¶
TimestampToTime converts timestamp to time.Time
func ToBytes ¶
ToBytes converts inteface{} (string, []byte , struct to ToByter interface to []byte for storing in state
func UnmarshallPtr ¶
UnmarshallPtr unmarshalls [] byte to pointer, and returns value pointed to
Types ¶
Click to show internal directories.
Click to hide internal directories.