jsonmanager

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: AGPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultJSONManager

type DefaultJSONManager struct {
	// contains filtered or unexported fields
}

DefaultJSONManager is the default implementation of the JSONManager interface.

func (*DefaultJSONManager) Delete

func (jm *DefaultJSONManager) Delete(path string) error

Delete removes a value from the JSON data at the specified path.

func (*DefaultJSONManager) Get

func (jm *DefaultJSONManager) Get(path string) gjson.Result

Get retrieves the value at the specified path in the JSON data.

func (*DefaultJSONManager) Set

func (jm *DefaultJSONManager) Set(path string, value interface{}) error

Set updates the JSON data at the specified path with the provided value.

func (*DefaultJSONManager) String

func (jm *DefaultJSONManager) String() string

String returns the JSON data as a string.

func (*DefaultJSONManager) Unmarshal

func (jm *DefaultJSONManager) Unmarshal() interface{}

Unmarshal parses the JSON data and returns it as an interface{}.

type JSONManager

type JSONManager interface {
	ReadJSONManager
	Set(path string, value interface{}) error // Set updates the JSON data at the specified path with the provided value.
	Delete(path string) error                 // Delete removes a value from the JSON data at the specified path.
}

JSONManager is the interface that defines methods for reading, writing, and deleting JSON data.

func NewJSONManager

func NewJSONManager() JSONManager

NewJSONManager creates a new instance of DefaultJSONManager with empty JSON data.

func NewJSONManagerFromString

func NewJSONManagerFromString(data string) (JSONManager, error)

NewJSONManagerFromString creates a new instance of DefaultJSONManager with the given JSON data. It checks if the provided data is valid JSON before creating the instance.

type ReadJSONManager

type ReadJSONManager interface {
	Get(path string) gjson.Result // Get retrieves the value at the specified path in the JSON data.
	String() string               // String returns the JSON data as a string.
	Unmarshal() interface{}       // Unmarshal parses the JSON data and returns it as an interface{}.
}

ReadJSONManager is the interface that allows read operations.

type ReadOnlyJSONManager

type ReadOnlyJSONManager interface {
	ReadJSONManager
}

ReadOnlyJSONManager is the interface that allows only read operations.

Jump to

Keyboard shortcuts

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