object

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExist = errors.New("does not exist")
)

Functions

This section is empty.

Types

type DataTypes

type DataTypes interface {
	Opaque | Refrence
}

type MatchType

type MatchType int
const (
	ExactMatch MatchType = iota
	PrefixMatch
	SuffixMatch
	SubMatch
	RegExMatch
)

type Object

type Object[T DataTypes] interface {
	Children() []string
	Child(any) Selector[T]
	CreatePath(path ...string) (Object[T], error)
	Fetch(path ...string) (Object[T], error)
	Set(string, T)
	Get(string) T
	GetString(string) (string, error)
	GetInt(string) (int, error)
	GetBool(string) (bool, error)
	Delete(string)
	Move(string, string) error // rename attribute
	Map() map[string]any
	Flat() map[string]any
	Match(string, MatchType) ([]Object[T], error)
}

func New

func New[T DataTypes]() Object[T]

type Opaque

type Opaque []byte

type Refrence

type Refrence any

type Resolver

type Resolver[T DataTypes] interface {
	Root() Object[T]
	Resolve(path ...string) (Object[T], error)
}

func NewResolver

func NewResolver[T DataTypes](root Object[T]) Resolver[T]

type Selector

type Selector[T DataTypes] interface {
	Name() string
	Exists() bool
	Rename(string) error       // rename self in parent
	Move(string, string) error // rename attribute
	Set(string, T) error
	Get(string) (T, error)
	GetString(string) (string, error)
	GetInt(string) (int, error)
	GetBool(string) (bool, error)
	Delete(string)
	Add(Object[T]) error
	Object() (Object[T], error)
}

Jump to

Keyboard shortcuts

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