Documentation ¶
Overview ¶
Package dsindex provides secondary indexing functionality for a datastore.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyKey = errors.New("key is empty") ErrEmptyValue = errors.New("value is empty") )
Functions ¶
Types ¶
type Indexer ¶
type Indexer interface { // Add adds the specified value to the key Add(ctx context.Context, key, value string) error // Delete deletes the specified value from the key. If the value is not in // the datastore, this method returns no error. Delete(ctx context.Context, key, value string) error // DeleteKey deletes all values in the given key. If a key is not in the // datastore, this method returns no error. Returns a count of values that // were deleted. DeleteKey(ctx context.Context, key string) (count int, err error) // DeleteAll deletes all keys managed by this Indexer. Returns a count of // the values that were deleted. DeleteAll(ctx context.Context) (count int, err error) // ForEach calls the function for each value in the specified key, until // there are no more values, or until the function returns false. If key // is empty string, then all keys are iterated. ForEach(ctx context.Context, key string, fn func(key, value string) bool) error // HasValue determines if the key contains the specified value HasValue(ctx context.Context, key, value string) (bool, error) // HasAny determines if any value is in the specified key. If key is // empty string, then all values are searched. HasAny(ctx context.Context, key string) (bool, error) // Search returns all values for the given key Search(ctx context.Context, key string) (values []string, err error) }
Indexer maintains a secondary index. An index is a collection of key-value mappings where the key is the secondary index that maps to one or more values, where each value is a unique key being indexed.
Click to show internal directories.
Click to hide internal directories.