encoding

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 5 Imported by: 5 modules, 12 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package encoding defines types and functions used for dealing with stringified-JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal added in v0.1.3

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

Marshal converts a value into stringified-JSON

func Stringify added in v0.1.3

func Stringify(v interface{}) (interface{}, error)

Stringify converts any supported type into a stringified value

func Unmarshal added in v0.1.3

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

Unmarshal converts stringified-JSON into the passed-in type

func Unstringify added in v0.1.3

func Unstringify(data map[string]interface{}, v interface{}) error

Unstringify takes a stringified representation of a value and populates it into the supplied interface

Types

type Bool

type Bool bool

Bool is a bool type to be used when the default json marshaler/unmarshaler cannot be avoided

func NewBool

func NewBool(bb bool) *Bool

func (Bool) MarshalJSON

func (b Bool) MarshalJSON() ([]byte, error)

func (*Bool) UnmarshalJSON

func (b *Bool) UnmarshalJSON(data []byte) error

func (*Bool) Value

func (b *Bool) Value() *bool

type Float

type Float float64

Float is a float type to be used when the default json marshaler/unmarshaler cannot be avoided

func NewFloat

func NewFloat(ff float64) *Float

func (Float) MarshalJSON

func (f Float) MarshalJSON() ([]byte, error)

func (*Float) UnmarshalJSON

func (f *Float) UnmarshalJSON(data []byte) error

func (*Float) Value

func (f *Float) Value() *float64

type Int

type Int int64

Int is an int type to be used when the default json marshaler/unmarshaler cannot be avoided

func NewInt

func NewInt(ii int64) *Int

func (Int) MarshalJSON

func (i Int) MarshalJSON() ([]byte, error)

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(data []byte) error

func (*Int) Value

func (i *Int) Value() *int64

type String

type String string

String is a string type to be used when the default json marshaler/unmarshaler cannot be avoided

func NewString

func NewString(ss string) *String

func (String) MarshalJSON

func (s String) MarshalJSON() ([]byte, error)

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(data []byte) error

func (*String) Value

func (s *String) Value() *string

Jump to

Keyboard shortcuts

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