gjson

package
v0.0.0-...-2bcc11b Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatIndent

func FormatIndent(p []byte) ([]byte, error)

func IsValid

func IsValid(json string) bool

func Iterate

func Iterate(jsonStr *string, indent bool, iterFn IterFn) error

func JSONDecode

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

JSONDecode decodes JSON data into a structure

func MarshalAndPrintln

func MarshalAndPrintln(x interface{})

func MarshalBytes

func MarshalBytes(v interface{}, indent bool) ([]byte, error)

func MarshalBytesDefault

func MarshalBytesDefault(v interface{}, indent bool) []byte

func MarshalBytesFast

func MarshalBytesFast(v easyjson.Marshaler) ([]byte, error)

func MarshalBytesWithErrFmt

func MarshalBytesWithErrFmt(v interface{}, indent bool, errFmt string) []byte

func MarshalString

func MarshalString(v interface{}, indent bool) (string, error)

func MarshalStringDefault

func MarshalStringDefault(v interface{}, indent bool) string

func MarshalStringWithErrFmt

func MarshalStringWithErrFmt(v interface{}, indent bool, errFmt string) string

func Set

func Set(jsonstr string, path []string, val interface{}) (string, error)

func UnmarshalBytesFast

func UnmarshalBytesFast(data []byte, v easyjson.Unmarshaler) error

Types

type IterFn

type IterFn = func(key string, val interface{}) (newVal interface{}, modified bool, err error)

type JifTimestamp

type JifTimestamp time.Time

Json index friendly timestamp. Why choose format time as nanosecond int64, but not human readable string? time.RFC3339Nano is the only format which can format time with nanosecond accuracy, but it has timezone information in it, when you need create unique index for timestamp in json/jsonb database, same epoch timestamps in different timezone may be considered as different string/index.

func (JifTimestamp) MarshalJSON

func (t JifTimestamp) MarshalJSON() ([]byte, error)

type JsonValue

type JsonValue gjson.Result

func Get

func Get(json, path string) JsonValue

func (JsonValue) Bool

func (v JsonValue) Bool() bool

func (JsonValue) Exists

func (v JsonValue) Exists() bool

func (JsonValue) Float

func (v JsonValue) Float() float64

func (JsonValue) Int64

func (v JsonValue) Int64() int64

func (JsonValue) String

func (v JsonValue) String() string

func (JsonValue) Time

func (v JsonValue) Time() time.Time

Jump to

Keyboard shortcuts

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