Documentation
¶
Index ¶
- type CacheQuerier
- func (c CacheQuerier) Filter(_ context.Context, filter Predicate) (EntityList, error)
- func (c CacheQuerier) Get(_ context.Context, id EntityID) *Entity
- func (c CacheQuerier) GroupBy(_ context.Context, fn GroupByFunction) (EntityListMap, error)
- func (c CacheQuerier) Iterate(_ context.Context, fn IteratorFunction) error
- type Entity
- type EntityContentGetter
- type EntityID
- type EntityList
- type EntityListMap
- type EntityPropertyNotFoundError
- type EntityQuerier
- type EntitySource
- type Group
- func (g *Group) Filter(ctx context.Context, filter Predicate) (EntityList, error)
- func (g *Group) Get(ctx context.Context, id EntityID) *Entity
- func (g *Group) GetContent(ctx context.Context, id EntityID) (interface{}, error)
- func (g *Group) GroupBy(ctx context.Context, fn GroupByFunction) (EntityListMap, error)
- func (g *Group) Iterate(ctx context.Context, fn IteratorFunction) error
- type GroupByFunction
- type IteratorFunction
- type NoContentSource
- type Predicate
- type SortFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheQuerier ¶
type CacheQuerier struct {
// contains filtered or unexported fields
}
func NewCacheQuerier ¶
func NewCacheQuerier(entities map[EntityID]Entity) *CacheQuerier
func (CacheQuerier) Filter ¶
func (c CacheQuerier) Filter(_ context.Context, filter Predicate) (EntityList, error)
func (CacheQuerier) GroupBy ¶
func (c CacheQuerier) GroupBy(_ context.Context, fn GroupByFunction) (EntityListMap, error)
func (CacheQuerier) Iterate ¶
func (c CacheQuerier) Iterate(_ context.Context, fn IteratorFunction) error
type EntityContentGetter ¶
type EntityContentGetter interface {
GetContent(ctx context.Context, id EntityID) (interface{}, error)
}
EntityContentGetter is used to retrieve arbitrary content linked to the entities. For instance, the actual package to install, etc.
type EntityList ¶
type EntityList []Entity
func (EntityList) CollectIds ¶
func (r EntityList) CollectIds() []EntityID
func (EntityList) Sort ¶
func (r EntityList) Sort(fn SortFunction) EntityList
type EntityListMap ¶
type EntityListMap map[string]EntityList
func (EntityListMap) Sort ¶
func (g EntityListMap) Sort(fn SortFunction) EntityListMap
type EntityPropertyNotFoundError ¶
type EntityPropertyNotFoundError string
func (EntityPropertyNotFoundError) Error ¶
func (p EntityPropertyNotFoundError) Error() string
type EntityQuerier ¶
type EntityQuerier interface { Get(ctx context.Context, id EntityID) *Entity Filter(ctx context.Context, filter Predicate) (EntityList, error) GroupBy(ctx context.Context, fn GroupByFunction) (EntityListMap, error) Iterate(ctx context.Context, fn IteratorFunction) error }
EntityQuerier is an interface for querying entities in some store
type EntitySource ¶
type EntitySource interface { EntityQuerier EntityContentGetter }
EntitySource provides a query and content acquisition interface for arbitrary entity stores
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a simple EntitySource implementation which groups various entity sources to provide a single interface by which to query them and get content
func NewGroup ¶
func NewGroup(entitySources ...EntitySource) *Group
func (*Group) GetContent ¶
func (*Group) GroupBy ¶
func (g *Group) GroupBy(ctx context.Context, fn GroupByFunction) (EntityListMap, error)
type GroupByFunction ¶
GroupByFunction transforms an entity into a slice of keys (strings) over which the entities will be grouped by
type IteratorFunction ¶
IteratorFunction is executed for each entity when iterating over all entities
type NoContentSource ¶
type NoContentSource struct{}
func (*NoContentSource) GetContent ¶
func (n *NoContentSource) GetContent(_ context.Context, _ EntityID) (interface{}, error)
type SortFunction ¶
SortFunction returns true if e1 is less than e2