jsonutil

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeLayout = "2006-01-02 15:04:05"
)

TimeLayout a common layout time format

Variables

This section is empty.

Functions

func Traverse

func Traverse(b string, callback TraverseCallback)

Traverse traverse json object and call the callback function

func TraverseBytes

func TraverseBytes(b []byte, callback TraverseCallback)

TraverseBytes is like Traverse but more efficient if use bytes

Types

type JSONTime added in v1.2.0

type JSONTime time.Time

JSONTime is a common layout time format, fully compatible with JSON and GORM

func (JSONTime) MarshalJSON added in v1.2.0

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

func (*JSONTime) Scan added in v1.2.0

func (t *JSONTime) Scan(v interface{}) error

func (JSONTime) ToTime added in v1.2.0

func (t JSONTime) ToTime() time.Time

func (*JSONTime) UnmarshalJSON added in v1.2.0

func (t *JSONTime) UnmarshalJSON(data []byte) error

func (JSONTime) Value added in v1.2.0

func (t JSONTime) Value() (driver.Value, error)

type Key

type Key struct {
	Key  interface{}
	Type KeyType
}

Key json key

type KeyType

type KeyType int

KeyType the json key type

const (
	// String regular key-value json key type
	String KeyType = iota + 1

	// Index is array key type
	Index
)

type TraverseCallback

type TraverseCallback func(key *Key, value *gjson.Result, path []byte)

TraverseCallback callback function, will be called during traverse

Jump to

Keyboard shortcuts

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