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 JsonUnmarshalPtr(bb []byte, to interface{}) (result interface{}, err error)
- func ProtoUnmarshal(bb []byte, messageType proto.Message) (message proto.Message, err error)
- func TimestampToTime(ts *timestamp.Timestamp) time.Time
- func ToBytes(value interface{}) ([]byte, 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`) )
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 JsonUnmarshalPtr ¶
JsonUnmarshalPtr unmarshalls []byte as json to pointer, and returns value pointed to
func ProtoUnmarshal ¶
ProtoUnmarshal r unmarshalls []byte as proto.Message to pointer, and returns value pointed to
func TimestampToTime ¶
TimestampToTime converts timestamp to time.Time
Types ¶
Click to show internal directories.
Click to hide internal directories.