wrap

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToAny

func ToAny(v *JsonValue) any

Types

type JsonArray

type JsonArray []*JsonValue

func (JsonArray) Append

func (a JsonArray) Append(v *JsonValue) JsonArray

func (JsonArray) Empty

func (a JsonArray) Empty() bool

func (JsonArray) Get

func (a JsonArray) Get(i int) *JsonValue

func (JsonArray) Len

func (a JsonArray) Len() int

func (JsonArray) Set

func (a JsonArray) Set(i int, v *JsonValue)

type JsonKey

type JsonKey []JsonKeyElm

func (JsonKey) Append added in v0.0.6

func (k JsonKey) Append(key JsonKeyElm) JsonKey

func (JsonKey) AppendInt added in v0.0.6

func (k JsonKey) AppendInt(index int) JsonKey

func (JsonKey) AppendStr added in v0.0.6

func (k JsonKey) AppendStr(key string) JsonKey

func (JsonKey) Equals added in v0.0.6

func (k JsonKey) Equals(other JsonKey) bool

func (JsonKey) Get added in v0.0.6

func (k JsonKey) Get(index int) (JsonKeyElm, bool)

func (JsonKey) Len added in v0.0.6

func (k JsonKey) Len() int

type JsonKeyElm added in v0.0.6

type JsonKeyElm string

func (JsonKeyElm) Integer added in v0.0.6

func (e JsonKeyElm) Integer() (int, bool)

func (JsonKeyElm) String added in v0.0.6

func (e JsonKeyElm) String() string

type JsonObject

type JsonObject map[string]*JsonValue

func (JsonObject) Del

func (o JsonObject) Del(k string)

func (JsonObject) Empty

func (o JsonObject) Empty() bool

func (JsonObject) Get

func (o JsonObject) Get(k string) *JsonValue

func (JsonObject) Has

func (o JsonObject) Has(k string) bool

func (JsonObject) Keys

func (o JsonObject) Keys() []string

func (JsonObject) Len

func (o JsonObject) Len() int

func (JsonObject) Set

func (o JsonObject) Set(k string, v *JsonValue)

type JsonType

type JsonType int
const (
	JsonTypeNull JsonType = iota
	JsonTypeString
	JsonTypeNumber
	JsonTypeBoolean
	JsonTypeArray
	JsonTypeObject
)

type JsonValue

type JsonValue struct {
	Type         JsonType
	StringValue  string
	NumberValue  json.Number
	BooleanValue bool
	ArrayValue   JsonArray
	ObjectValue  JsonObject
}

func Array

func Array(av ...*JsonValue) *JsonValue

func Boolean

func Boolean(v bool) *JsonValue

func FromAny

func FromAny(valAny any) (jv *JsonValue, err error)

func Null

func Null() *JsonValue

func Number

func Number[T json.Number | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64](v T) *JsonValue

func Object

func Object(mv map[string]*JsonValue) *JsonValue

func String

func String(v string) *JsonValue

func (*JsonValue) Float64

func (v *JsonValue) Float64() (float64, bool)

func (*JsonValue) Int64

func (v *JsonValue) Int64() (int64, bool)

func (*JsonValue) MarshalJSON

func (v *JsonValue) MarshalJSON() ([]byte, error)

func (*JsonValue) MustArray

func (v *JsonValue) MustArray() JsonArray

func (*JsonValue) MustBool

func (v *JsonValue) MustBool() bool

func (*JsonValue) MustNumber

func (v *JsonValue) MustNumber() json.Number

func (*JsonValue) MustObject

func (v *JsonValue) MustObject() JsonObject

func (*JsonValue) MustString

func (v *JsonValue) MustString() string

func (*JsonValue) UnmarshalJSON

func (v *JsonValue) UnmarshalJSON(b []byte) error

func (*JsonValue) Walk

func (v *JsonValue) Walk(visitor func(key JsonKey, val *JsonValue) error) error

Jump to

Keyboard shortcuts

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