badjson

package
v0.6.0-alpha.14 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: GPL-2.0 Imports: 10 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(ctx context.Context, content []byte) (any, error)

func MarshallObjects added in v0.5.0

func MarshallObjects(objects ...any) ([]byte, error)

func MarshallObjectsContext

func MarshallObjectsContext(ctx context.Context, objects ...any) ([]byte, error)

func Merge

func Merge[T any](ctx context.Context, source T, destination T, disableAppend bool) (T, error)

func MergeFrom

func MergeFrom[T any](ctx context.Context, rawSource json.RawMessage, rawDestination json.RawMessage, disableAppend bool) (T, error)

func MergeFromDestination

func MergeFromDestination[T any](ctx context.Context, source T, rawDestination json.RawMessage, disableAppend bool) (T, error)

func MergeFromSource

func MergeFromSource[T any](ctx context.Context, rawSource json.RawMessage, destination T, disableAppend bool) (T, error)

func MergeJSON

func MergeJSON(ctx context.Context, rawSource json.RawMessage, rawDestination json.RawMessage, disableAppend bool) (json.RawMessage, error)

func Omitempty

func Omitempty[T any](ctx context.Context, value T) (T, error)

func UnmarshallExcluded added in v0.5.0

func UnmarshallExcluded(inputContent []byte, parentObject any, object any) error

func UnmarshallExcludedContext

func UnmarshallExcludedContext(ctx context.Context, inputContent []byte, parentObject any, object any) error

Types

type JSONArray

type JSONArray []any

func (JSONArray) IsEmpty added in v0.4.0

func (a JSONArray) IsEmpty() bool

func (JSONArray) MarshalJSON

func (a JSONArray) MarshalJSON() ([]byte, error)

func (*JSONArray) UnmarshalJSON

func (a *JSONArray) UnmarshalJSON(content []byte) error

type JSONObject

type JSONObject struct {
	linkedhashmap.Map[string, any]
}

func (*JSONObject) IsEmpty added in v0.4.0

func (m *JSONObject) IsEmpty() bool

func (*JSONObject) MarshalJSON

func (m *JSONObject) MarshalJSON() ([]byte, error)

func (*JSONObject) MarshalJSONContext

func (m *JSONObject) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*JSONObject) UnmarshalJSON

func (m *JSONObject) UnmarshalJSON(content []byte) error

func (*JSONObject) UnmarshalJSONContext

func (m *JSONObject) UnmarshalJSONContext(ctx context.Context, content []byte) error

type TypedMap

type TypedMap[K comparable, V any] struct {
	linkedhashmap.Map[K, V]
}

func (TypedMap[K, V]) MarshalJSON

func (m TypedMap[K, V]) MarshalJSON() ([]byte, error)

func (TypedMap[K, V]) MarshalJSONContext

func (m TypedMap[K, V]) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*TypedMap[K, V]) UnmarshalJSON

func (m *TypedMap[K, V]) UnmarshalJSON(content []byte) error

func (*TypedMap[K, V]) UnmarshalJSONContext

func (m *TypedMap[K, V]) UnmarshalJSONContext(ctx context.Context, content []byte) error

Jump to

Keyboard shortcuts

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