structure

package
v0.0.0-...-9f7285a Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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
}

func (*FieldEqualityFilter) Filter

func (f *FieldEqualityFilter) Filter(reader *Reader) (bool, error)

Filter implements ReaderFilter.

type Reader

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

func (*Reader) ChildReader

func (r *Reader) ChildReader(childName string) (*Reader, error)

ChildReader get a Reader from direct children of this node.

func (*Reader) Has

func (r *Reader) Has(path string) bool

Has returns true only when fields matching with the path is contained in the data

func (*Reader) ReadInt

func (r *Reader) ReadInt(path string) (int, error)

func (*Reader) ReadIntOrDefault

func (r *Reader) ReadIntOrDefault(path string, defaultValue int) int

func (*Reader) ReadReflect

func (r *Reader) ReadReflect(path string, target interface{}) error

func (*Reader) ReadReflectK8sManifest

func (r *Reader) ReadReflectK8sManifest(path string, target runtime.Object) error

func (*Reader) ReadString

func (r *Reader) ReadString(path string) (string, error)

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 (r *Reader) ReadStringOrDefault(path string, defaultValue string) string

func (*Reader) ReadTimeAsString

func (r *Reader) ReadTimeAsString(path string) (string, error)

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

func (r *Reader) ReaderSingle(path string) (*Reader, error)

ReaderSingle calls the Reader method with expecting it to return a single reader as the result.

func (*Reader) ToJson

func (r *Reader) ToJson(path string) (string, error)

func (*Reader) ToYaml

func (r *Reader) ToYaml(path string) (string, error)

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 (*ReaderFactory) NewReader

func (f *ReaderFactory) NewReader(adapter ReaderDataAdapter) (*Reader, error)

type ReaderFilter

type ReaderFilter interface {
	Filter(reader *Reader) (bool, error)
}

func EqualFilter

func EqualFilter(fieldName string, equalTo any) ReaderFilter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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