Documentation ¶
Index ¶
- type FieldEqualityFilter
- type Reader
- func (r *Reader) ChildReader(childName string) (*Reader, error)
- func (r *Reader) Has(path string) bool
- func (r *Reader) ReadInt(path string) (int, error)
- func (r *Reader) ReadIntOrDefault(path string, defaultValue int) int
- func (r *Reader) ReadReflect(path string, target interface{}) error
- func (r *Reader) ReadReflectK8sManifest(path string, target runtime.Object) error
- func (r *Reader) ReadString(path string) (string, error)
- func (r *Reader) ReadStringOrDefault(path string, defaultValue string) string
- func (r *Reader) ReadTimeAsString(path string) (string, error)
- func (r *Reader) Reader(path string, filters ...[]ReaderFilter) ([]*Reader, error)
- func (r *Reader) ReaderFromArrayRoute(route []string, filters ...[]ReaderFilter) ([]*Reader, error)
- func (r *Reader) ReaderSingle(path string) (*Reader, error)
- func (r *Reader) ToJson(path string) (string, error)
- func (r *Reader) ToYaml(path string) (string, error)
- type ReaderDataAdapter
- type ReaderFactory
- type ReaderFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldEqualityFilter ¶
type FieldEqualityFilter struct {
// contains filtered or unexported fields
}
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewReader ¶
func NewReader(store structuredatastore.StructureDataStorageRef) *Reader
func (*Reader) ChildReader ¶
ChildReader get a Reader from direct children of this node.
func (*Reader) Has ¶
Has returns true only when fields matching with the path is contained in the data
func (*Reader) ReadIntOrDefault ¶
func (*Reader) ReadReflect ¶
func (*Reader) ReadReflectK8sManifest ¶
func (*Reader) ReadString ¶
ReadString attempts to read and return a string value at the specified path. It returns an error if the path is not found, is not a string type, or if more than one reader matches the path.
func (*Reader) ReadStringOrDefault ¶
func (*Reader) ReadTimeAsString ¶
ReadTimeAsString attempts to read the path as string or time.Time.
func (*Reader) Reader ¶
func (r *Reader) Reader(path string, filters ...[]ReaderFilter) ([]*Reader, error)
Reader navigates a hierarchical data structure using the provided path and optional filters. If the path resolves to multiple elements (typically array elements), an array of corresponding Readers is returned. Filters allow you to selectively include elements at each array level encountered during the path navigation. This function won't work with a path including `.` in the route. Use `ReaderFromArrayRoute` for the case.
The 'filters' argument accepts a variable number of ReaderFilter arrays. Each array contains filters corresponding to a specific array level within the path.
Example Paths:
"data.items[].name" // Access 'name' in each item within the 'items' "config" // Access root-level 'config'
func (*Reader) ReaderFromArrayRoute ¶
func (r *Reader) ReaderFromArrayRoute(route []string, filters ...[]ReaderFilter) ([]*Reader, error)
func (*Reader) ReaderSingle ¶
ReaderSingle calls the Reader method with expecting it to return a single reader as the result.
type ReaderDataAdapter ¶
type ReaderDataAdapter interface { // GetReaderBackedByStore the given data into a structuredata.StructureData GetReaderBackedByStore(store structuredatastore.StructureDataStore) (*Reader, error) }
ReaderDataAdapter convert a type to a structuredata.StructureData with storing the data in the StructureDataStore instanciated from StuctureDataFactory.
type ReaderFactory ¶
type ReaderFactory struct {
// contains filtered or unexported fields
}
ReaderFactory instanciate the instance of Reader.
func NewReaderFactory ¶
func NewReaderFactory(store structuredatastore.StructureDataStore) *ReaderFactory
func (*ReaderFactory) NewReader ¶
func (f *ReaderFactory) NewReader(adapter ReaderDataAdapter) (*Reader, error)
type ReaderFilter ¶
func EqualFilter ¶
func EqualFilter(fieldName string, equalTo any) ReaderFilter