Documentation ¶
Index ¶
- Variables
- func GetJSONObj(str string, out interface{})
- func GetJSONStr(obj interface{}, isFormat bool) string
- func GzipDecode(in []byte) ([]byte, error)
- func GzipEncode(in []byte) ([]byte, error)
- func JSONDecode(obj interface{}) string
- func JSONEncode(str string, out interface{})
- func JSONPrettyDecode(obj interface{}) string
- func Marshal(e Encoding, v interface{}) (data []byte, err error)
- func MarshalToString(v interface{}) string
- func Unmarshal(e Encoding, data []byte, v interface{}) (err error)
- type Encoding
- type GobEncoding
- type JSONEncoding
- type JSONGzipEncoding
- type JSONSnappyEncoding
- type MsgPackEncoding
- type PhpSerializeEncoding
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotAPointer = errors.New("v argument must be a pointer")
)
Functions ¶
func GetJSONObj ¶ added in v0.1.1
func GetJSONObj(str string, out interface{})
GetJSONObj string convert to obj
func GetJSONStr ¶ added in v0.1.1
func JSONEncode ¶ added in v0.1.1
func JSONEncode(str string, out interface{})
JSONEncode string convert to obj
func JSONPrettyDecode ¶ added in v0.1.1
func JSONPrettyDecode(obj interface{}) string
Types ¶
type Encoding ¶
type Encoding interface { Marshal(v interface{}) ([]byte, error) Unmarshal(data []byte, v interface{}) error }
Encoding 编码接口定义
type GobEncoding ¶
type GobEncoding struct{}
func (GobEncoding) Marshal ¶
func (g GobEncoding) Marshal(v interface{}) ([]byte, error)
func (GobEncoding) Unmarshal ¶
func (g GobEncoding) Unmarshal(data []byte, value interface{}) error
type JSONEncoding ¶
type JSONEncoding struct{}
func (JSONEncoding) Marshal ¶
func (j JSONEncoding) Marshal(v interface{}) ([]byte, error)
func (JSONEncoding) Unmarshal ¶
func (j JSONEncoding) Unmarshal(data []byte, value interface{}) error
type JSONGzipEncoding ¶
type JSONGzipEncoding struct{}
func (JSONGzipEncoding) Marshal ¶
func (jz JSONGzipEncoding) Marshal(v interface{}) ([]byte, error)
func (JSONGzipEncoding) Unmarshal ¶
func (jz JSONGzipEncoding) Unmarshal(data []byte, value interface{}) error
Unmarshal json encode and gzip
type JSONSnappyEncoding ¶
type JSONSnappyEncoding struct{}
func (JSONSnappyEncoding) Marshal ¶
func (s JSONSnappyEncoding) Marshal(v interface{}) (data []byte, err error)
Marshal 序列化
func (JSONSnappyEncoding) Unmarshal ¶
func (s JSONSnappyEncoding) Unmarshal(data []byte, value interface{}) error
Unmarshal 反序列化
type MsgPackEncoding ¶
type MsgPackEncoding struct{}
func (MsgPackEncoding) Marshal ¶
func (mp MsgPackEncoding) Marshal(v interface{}) ([]byte, error)
func (MsgPackEncoding) Unmarshal ¶
func (mp MsgPackEncoding) Unmarshal(data []byte, value interface{}) error
type PhpSerializeEncoding ¶ added in v0.0.4
type PhpSerializeEncoding struct{}
func (PhpSerializeEncoding) Marshal ¶ added in v0.0.4
func (p PhpSerializeEncoding) Marshal(v interface{}) ([]byte, error)
func (PhpSerializeEncoding) Unmarshal ¶ added in v0.0.4
func (p PhpSerializeEncoding) Unmarshal(data []byte, value interface{}) error
Click to show internal directories.
Click to hide internal directories.