json

package
v0.0.0-...-fc1a460 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDeepEqual

func IsDeepEqual[Old comparable, New comparable](old Old, new New, omitJsonKeys ...string) bool

func JSONBytesEqual

func JSONBytesEqual(a, b []byte) (bool, error)

func WriteJsonToFile

func WriteJsonToFile(data JSON, path string) error

Types

type JSON

type JSON json.RawMessage

func MustJSON

func MustJSON(value any) JSON

func NewEmptyObject

func NewEmptyObject() JSON

func NewJSON

func NewJSON(value any) (JSON, error)

Convert Json string to bytes,

func NewJSONNull

func NewJSONNull() JSON

func ReadJsonFile

func ReadJsonFile(path string) (JSON, error)

using base path ./app/....

can't use relative path

func (JSON) ArrayInt

func (j JSON) ArrayInt() []int

func (JSON) Dump

func (j JSON) Dump() any

Unmarshal | string, remove json whitespace

func (JSON) IsEqual

func (j JSON) IsEqual(dest JSON) bool

func (JSON) IsValid

func (j JSON) IsValid() bool

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

func (JSON) Object

func (j JSON) Object() map[string]any

func (JSON) Out

func (j JSON) Out(out interface{}) error

Convert Bytes

func (*JSON) Scan

func (j *JSON) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*JSON) Set

func (j *JSON) Set(value interface{}) error

Convert Struct to Bytes

func (JSON) String

func (j JSON) String() string

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(b []byte) error

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

Jump to

Keyboard shortcuts

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