data

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: LGPL-2.1 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LocatorObject   = "$"
	LocatorHeader   = "#"
	LocatorProperty = "@"
)

Variables

This section is empty.

Functions

func ElementToLocator added in v0.7.1

func ElementToLocator(locator IFlowDataLocator, idGenerator id.IGenerator, element schema.Element) (err error)

Types

type Container

type Container struct {
	schema.ItemAwareInterface
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer(itemAware schema.ItemAwareInterface) *Container

func (*Container) CloneFor

func (c *Container) CloneFor(other ILocatorCloner)

func (*Container) Get

func (c *Container) Get() IItem

func (*Container) Put

func (c *Container) Put(item IItem)

func (*Container) Unavailable

func (c *Container) Unavailable() bool

type DefaultItemAwareLocator

type DefaultItemAwareLocator struct{}

func (DefaultItemAwareLocator) Clone

func (d DefaultItemAwareLocator) Clone() map[string]any

func (DefaultItemAwareLocator) FindItemAwareById

func (d DefaultItemAwareLocator) FindItemAwareById(id schema.IdRef) (itemAware IItemAware, found bool)

func (DefaultItemAwareLocator) FindItemAwareByName

func (d DefaultItemAwareLocator) FindItemAwareByName(name string) (itemAware IItemAware, found bool)

func (DefaultItemAwareLocator) PutItemAwareById

func (d DefaultItemAwareLocator) PutItemAwareById(id schema.IdRef, itemAware IItemAware)

func (DefaultItemAwareLocator) PutItemAwareByName

func (d DefaultItemAwareLocator) PutItemAwareByName(name string, itemAware IItemAware)

type FlowDataLocator

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

func NewFlowDataLocator

func NewFlowDataLocator() *FlowDataLocator

func (*FlowDataLocator) CloneItems

func (f *FlowDataLocator) CloneItems(name string) map[string]any

func (*FlowDataLocator) CloneVariables

func (f *FlowDataLocator) CloneVariables() map[string]any

func (*FlowDataLocator) FindIItemAwareLocator

func (f *FlowDataLocator) FindIItemAwareLocator(name string) (locator IItemAwareLocator, found bool)

func (*FlowDataLocator) GetVariable

func (f *FlowDataLocator) GetVariable(name string) (value any, found bool)

func (*FlowDataLocator) Merge

func (f *FlowDataLocator) Merge(other IFlowDataLocator)

func (*FlowDataLocator) PutIItemAwareLocator

func (f *FlowDataLocator) PutIItemAwareLocator(name string, locator IItemAwareLocator)

func (*FlowDataLocator) SetVariable

func (f *FlowDataLocator) SetVariable(name string, value any)

type HeaderContainer

type HeaderContainer struct {
	DefaultItemAwareLocator
	// contains filtered or unexported fields
}

func NewHeaderContainer

func NewHeaderContainer() *HeaderContainer

func (*HeaderContainer) Clone

func (h *HeaderContainer) Clone() map[string]any

func (*HeaderContainer) CloneFor

func (h *HeaderContainer) CloneFor(other ILocatorCloner)

func (*HeaderContainer) FindItemAwareById

func (h *HeaderContainer) FindItemAwareById(id schema.IdRef) (IItemAware, bool)

func (*HeaderContainer) FindItemAwareByName

func (h *HeaderContainer) FindItemAwareByName(name string) (IItemAware, bool)

type IAsXML

type IAsXML interface {
	AsXML() []byte
}

type ICollection

type ICollection interface {
	IItem
	// ItemIterator returns a channel that iterates over collection's
	// items and an IteratorStopper that must be used if iterator was
	// not exhausted, otherwise there'll be a memory leak in a form
	// of a goroutine that does nothing.
	//
	// The iterator will also clean itself up and terminate upon
	// context termination.
	ItemIterator(ctx context.Context) (chan IItem, IIteratorStopper)
}

type IFlowDataLocator

type IFlowDataLocator interface {
	FindIItemAwareLocator(name string) (locator IItemAwareLocator, found bool)
	PutIItemAwareLocator(name string, locator IItemAwareLocator)
	CloneItems(name string) map[string]any
	GetVariable(name string) (value any, found bool)
	SetVariable(name string, value any)
	CloneVariables() map[string]any
	Merge(other IFlowDataLocator)
}

IFlowDataLocator interface describes a way to find and put IItemAwareLocator and Variables

type IItem

type IItem interface{}

IItem is an abstract interface for a piece of data

func ItemOrCollection

func ItemOrCollection(items ...IItem) (item IItem)

ItemOrCollection will return nil if no items given, the same item if only one item is given and SliceIterator if more than one item is given. SliceIterator implements Collection and, therefore, also implements Item.

type IItemAware

type IItemAware interface {
	// Get returns a channel that will eventually return the data item
	Get() IItem
	// Put puts to update the item
	Put(item IItem)
}

IItemAware provides basic interface of accessing data items

type IItemAwareLocator

type IItemAwareLocator interface {
	// FindItemAwareById finds ItemAware by its schema.Id
	FindItemAwareById(id schema.IdRef) (itemAware IItemAware, found bool)
	// FindItemAwareByName finds ItemAware by its name (where applicable)
	FindItemAwareByName(name string) (itemAware IItemAware, found bool)
	// PutItemAwareById puts ItemAware by its schema.Id
	PutItemAwareById(id schema.IdRef, itemAware IItemAware)
	// PutItemAwareByName puts ItemAware by its name (where applicable)
	PutItemAwareByName(name string, itemAware IItemAware)
	// Clone clones all IItem to the specified target
	Clone() map[string]any
}

IItemAwareLocator interface describes a way to find and put IItemAware

type IIteratorStopper

type IIteratorStopper interface {
	// Stop does the actual stopping
	Stop()
}

IIteratorStopper stops Collection iterator and releases resources associated with it

type ILocatorCloner

type ILocatorCloner interface {
	CloneFor(target ILocatorCloner)
}

ILocatorCloner provides basic interface of cloning data items

type ObjectContainer

type ObjectContainer struct {
	DefaultItemAwareLocator
	// contains filtered or unexported fields
}

func NewDataObjectContainer

func NewDataObjectContainer() *ObjectContainer

func (*ObjectContainer) Clone

func (do *ObjectContainer) Clone() map[string]any

func (*ObjectContainer) CloneFor

func (do *ObjectContainer) CloneFor(other ILocatorCloner)

func (*ObjectContainer) FindItemAwareById

func (do *ObjectContainer) FindItemAwareById(id schema.IdRef) (itemAware IItemAware, found bool)

func (*ObjectContainer) FindItemAwareByName

func (do *ObjectContainer) FindItemAwareByName(name string) (itemAware IItemAware, found bool)

func (*ObjectContainer) PutItemAwareById added in v0.2.0

func (do *ObjectContainer) PutItemAwareById(id schema.IdRef, itemAware IItemAware)

func (*ObjectContainer) PutItemAwareByName

func (do *ObjectContainer) PutItemAwareByName(name string, itemAware IItemAware)

type PropertyContainer

type PropertyContainer struct {
	DefaultItemAwareLocator
	// contains filtered or unexported fields
}

func NewPropertyContainer

func NewPropertyContainer() *PropertyContainer

func (*PropertyContainer) Clone

func (p *PropertyContainer) Clone() map[string]any

func (*PropertyContainer) CloneFor

func (p *PropertyContainer) CloneFor(other ILocatorCloner)

func (*PropertyContainer) FindItemAwareById

func (p *PropertyContainer) FindItemAwareById(id schema.IdRef) (IItemAware, bool)

func (*PropertyContainer) FindItemAwareByName

func (p *PropertyContainer) FindItemAwareByName(name string) (IItemAware, bool)

func (*PropertyContainer) PutItemAwareByName

func (p *PropertyContainer) PutItemAwareByName(name string, itemAware IItemAware)

type SliceIterator

type SliceIterator []IItem

func (*SliceIterator) ItemIterator

func (s *SliceIterator) ItemIterator(ctx context.Context) (items chan IItem, stop IIteratorStopper)

type XMLSource

type XMLSource []byte

func (XMLSource) AsXML

func (x XMLSource) AsXML() []byte

Jump to

Keyboard shortcuts

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