typemarshal

package
v0.0.0-...-cb58a95 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

将自定义类型Encode/Decode成JSON的包。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMarshaler

func DefaultMarshaler(v interface{}) ([]byte, error)

func Marshal

func Marshal(v interface{}) ([]byte, error)

func Register

func Register(name string, typ reflect.Type) error

func RegisterCustom

func RegisterCustom(name string, typ reflect.Type, marshal Marshaler, unmarshal Unmarshaler) error

func Unmarshal

func Unmarshal(data []byte) (interface{}, error)

Types

type Marshaler

type Marshaler func(v interface{}) ([]byte, error)

type Unmarshaler

type Unmarshaler func(data []byte) (interface{}, error)

func TypeUnmarshalerOf

func TypeUnmarshalerOf(typ reflect.Type) Unmarshaler

Jump to

Keyboard shortcuts

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