registry

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(source string) (map[string]map[string]interface{}, error)

All loads all entities from a data source. It will call `ecs.Create` passing the map returned by the data source for each entity, and return a map of entities keyed by their ids.

func Count

func Count(source string, search map[string]interface{}) (int64, error)

func Delete

func Delete(source string, entityId string) error

func Find

func Find(source string, search map[string]interface{}) (map[string]map[string]interface{}, error)

Find returns a list of entities from executing a search against a provided map. It returns a list of entities as a map keyed by their ids. It passes each entity found through `ecs.create`, If the entity does not have valid metadata, or that metadata does not define the entity type, an error is thrown. If the data source does not exist, an error will be thrown.

func FindAndDelete

func FindAndDelete(source string, search map[string]interface{}) error

func FindOne

func FindOne(source string, search map[string]interface{}) (string, map[string]interface{}, error)

func Register

func Register(dataSource data_source.DataSource)

func Save

func Save(source string, entityId string, entity map[string]interface{}) error

Save saves data to a data source for a given entity. If the entity does not have a valid metadata field an error will be thrown. If the data source does not exist, an error will be thrown. If the metadata field does not have a type set, an error will be thrown. If the entity exists in the data source, it will be overwritten.

func Start

func Start()

func StartDataSources

func StartDataSources()

func Stop

func Stop() error

Types

type InvalidDataSourceError

type InvalidDataSourceError struct {
	Source string
}

func (InvalidDataSourceError) Error

func (e InvalidDataSourceError) Error() string

type MetadataTypeRequiredError

type MetadataTypeRequiredError struct {
	ID string
}

func (MetadataTypeRequiredError) Error

Jump to

Keyboard shortcuts

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