encoding

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 0 Imported by: 2

Documentation

Overview

Example (Rawbyte_json)
var obj struct {
	Name   string   `json:"name"`
	Params RawBytes `json:"params"`
}
body := `{"name":"abc","params":"eeeddd"}`
err := json.Unmarshal([]byte(body), &obj)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(obj, string(obj.Params))
Output:

{abc [34 101 101 101 100 100 100 34]} "eeeddd"

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RawBytes

type RawBytes []byte

RawBytes .

func (RawBytes) Bytes

func (bs RawBytes) Bytes() []byte

Bytes convert bytes

func (*RawBytes) GobDecode

func (bs *RawBytes) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (RawBytes) GobEncode

func (bs RawBytes) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (RawBytes) MarshalBinary

func (bs RawBytes) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (RawBytes) MarshalJSON

func (bs RawBytes) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (RawBytes) MarshalText

func (bs RawBytes) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present.

func (*RawBytes) UnmarshalBinary

func (bs *RawBytes) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*RawBytes) UnmarshalJSON

func (bs *RawBytes) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*RawBytes) UnmarshalText

func (bs *RawBytes) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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