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.