json

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const FALSE = 57347
View Source
const NULL = 57348
View Source
const NUMBER = 57349
View Source
const OPERATOR = 57353
View Source
const OPERATOR_SHORTCUT = 57351
View Source
const PLACEHOLDER = 57350
View Source
const STRING = 57352
View Source
const TRUE = 57346

Variables

This section is empty.

Functions

func AppendMarshal

func AppendMarshal(buf *bytes.Buffer, v interface{}, indent int) error

AppendMarshal does the same as Marshal but appends the JSON encoding to "buf".

func Marshal

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

Marshal returns the JSON encoding of "v". It differs from encoding/json.Marshal() as it only handles map[string]interface{}, []interface{}, bool, float64, string, nil and encoding/json.Marshaler values. It also accepts "invalid" JSON data returned by MarshalJSON method.

func Parse

func Parse(buf []byte, opts ...ParseOpts) (interface{}, error)

Types

type Error

type Error struct {
	Pos Position
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

type Operator

type Operator struct {
	Name   string
	Params []interface{}
}

type ParseOpts

type ParseOpts struct {
	Placeholders       []interface{}
	PlaceholdersByName map[string]interface{}
	OpShortcutFn       func(string, Position) (interface{}, bool)
	OpFn               func(Operator, Position) (interface{}, error)
}

type Placeholder

type Placeholder struct {
	Num  int
	Name string
}

type Position

type Position struct {
	Pos  int
	Line int
	Col  int
	// contains filtered or unexported fields
}

func (Position) String

func (p Position) String() string

Jump to

Keyboard shortcuts

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