Documentation
¶
Overview ¶
Package memdb is an entirely in-memory database with no persistence and no concurrency guarantees. Its function is to provide a full database implementation to tests to run against.
Index ¶
- func New() (db.DB, error)
- type MemDB
- func (m *MemDB) DeleteEntity(ID string) error
- func (m *MemDB) DeleteGroup(name string) error
- func (m *MemDB) DiscoverEntityIDs() ([]string, error)
- func (m *MemDB) DiscoverGroupNames() ([]string, error)
- func (m *MemDB) LoadEntity(ID string) (*pb.Entity, error)
- func (m *MemDB) LoadGroup(name string) (*pb.Group, error)
- func (m *MemDB) NextEntityNumber() (int32, error)
- func (m *MemDB) NextGroupNumber() (int32, error)
- func (m *MemDB) SaveEntity(e *pb.Entity) error
- func (m *MemDB) SaveGroup(g *pb.Group) error
- func (m *MemDB) SearchEntities(r db.SearchRequest) ([]*pb.Entity, error)
- func (m *MemDB) SearchGroups(r db.SearchRequest) ([]*pb.Group, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemDB ¶
type MemDB struct {
// contains filtered or unexported fields
}
The MemDB type binds the methods of this "database". This DB is designed really only for supporting the tests of other modules, so keep in mind that it is not safe for concurrent execution.
func (*MemDB) DeleteEntity ¶
DeleteEntity deletes an entity from the "database".
func (*MemDB) DeleteGroup ¶
DeleteGroup deletes a group from the "database".
func (*MemDB) DiscoverEntityIDs ¶
DiscoverEntityIDs returns a list of entity IDs which can then be used to load particular entities.
func (*MemDB) DiscoverGroupNames ¶
DiscoverGroupNames returns a slice of strings that can be later used to load groups.
func (*MemDB) LoadEntity ¶
LoadEntity loads an entity from the "database".
func (*MemDB) NextEntityNumber ¶ added in v0.0.12
NextEntityNumber fetches out the next unassigned entity number.
func (*MemDB) NextGroupNumber ¶ added in v0.0.12
NextGroupNumber uses the util package to return a group number.
func (*MemDB) SaveEntity ¶
SaveEntity saves an entity to the "database".
func (*MemDB) SearchEntities ¶ added in v0.0.12
SearchEntities returns a slice of entity given a searchrequest.
func (*MemDB) SearchGroups ¶ added in v0.0.12
SearchGroups returns a slice of entity given a searchrequest.