util

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package util handles synthetic functions that aren't implemented natively on a datastore. These functions are almost by definition slower than if the datastore implemented an intelligent version natively, but they save work and test complexity in the simpler datastores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEntityBatch

func LoadEntityBatch(ids []string, l loadEntityFunc) ([]*pb.Entity, error)

LoadEntityBatch uses the specified loader to load a batch of entities as specified by the provided slice of IDs. any failure in the loading of an entity will abort the entire load.

func LoadGroupBatch

func LoadGroupBatch(ids []string, l loadGroupFunc) ([]*pb.Group, error)

LoadGroupBatch functions identically to LoadEntityBatch, with apropriate substitutions made for groups.

func NextEntityNumber

func NextEntityNumber(l loadEntityFunc, ids entityIDsFunc) (int32, error)

NextEntityNumber computes and returns the next unnassigned number in the entity space.

func NextGroupNumber

func NextGroupNumber(lf loadGroupFunc, names groupNamesFunc) (int32, error)

NextGroupNumber computes the enxt available group number and returns it.

Types

type SearchIndex

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

SearchIndex holds the methods to search entities and groups with blevesearch. This is meant to be embedded into a db implementation to transparently give it the search functions.

func NewIndex

func NewIndex() *SearchIndex

NewIndex returns a new SearchIndex with the mappings configured and ready to use. Mappings are statically defined for simplicity, and in general new mappings shouldn't be added without a very good reason.

func (*SearchIndex) DeleteEntity

func (s *SearchIndex) DeleteEntity(e *pb.Entity) error

DeleteEntity removes an entity from the index

func (*SearchIndex) DeleteGroup

func (s *SearchIndex) DeleteGroup(g *pb.Group) error

DeleteGroup removes a group from the index.

func (*SearchIndex) IndexEntity

func (s *SearchIndex) IndexEntity(e *pb.Entity) error

IndexEntity adds or updates an entity in the index.

func (*SearchIndex) IndexGroup

func (s *SearchIndex) IndexGroup(g *pb.Group) error

IndexGroup adds or updates a group in the index.

func (*SearchIndex) SearchEntities

func (s *SearchIndex) SearchEntities(r db.SearchRequest) ([]string, error)

SearchEntities searches the index for entities matching the qualities specified in the request.

func (*SearchIndex) SearchGroups

func (s *SearchIndex) SearchGroups(r db.SearchRequest) ([]string, error)

SearchGroups searches the index for groups matching the qualities specified in the request.

Jump to

Keyboard shortcuts

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