Documentation
¶
Index ¶
- func MatcherFunc(object data.Object) expression.MatcherFunc
- func New() data.Datastore
- type Collection
- type Datastore
- func (db *Datastore) Close()
- func (db *Datastore) Delete(collection string, object data.Object, comment string) *derp.Error
- func (db *Datastore) List(collection string, criteria expression.Expression, options ...option.Option) (data.Iterator, *derp.Error)
- func (db *Datastore) Load(collection string, criteria expression.Expression, target data.Object) *derp.Error
- func (db *Datastore) Save(collection string, object data.Object, comment string) *derp.Error
- func (db *Datastore) Session(ctx context.Context) data.Session
- type Iterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatcherFunc ¶
func MatcherFunc(object data.Object) expression.MatcherFunc
MatcherFunc is a helper function that uses reflection to look inside a generic data.Object and match it. Because it uses reflection, it should be considered SLOW, and only be used in the mock library.
Types ¶
type Datastore ¶
type Datastore map[string]Collection
Datastore is a mock database
func (*Datastore) Close ¶
func (db *Datastore) Close()
Close cleans up any remaining data created by the mock session.
func (*Datastore) List ¶
func (db *Datastore) List(collection string, criteria expression.Expression, options ...option.Option) (data.Iterator, *derp.Error)
List retrieves a group of records as an Iterator.
func (*Datastore) Load ¶
func (db *Datastore) Load(collection string, criteria expression.Expression, target data.Object) *derp.Error
Load retrieves a single record from the mock collection.
type Iterator ¶
Iterator represents a generic set of data that can be returned by a datasource.
func NewIterator ¶
NewIterator generates
func (*Iterator) Less ¶
Less reports whether the element with index i should sort before the element with index j. A return value of TRUE means that the item in position "i" should appear ahead of the item in position "j".
func (*Iterator) Next ¶
Next moves the Iterator to the next position in the dataset. If there is another record in the dataset, it returns TRUE, and writes the next record to the "output" variable. If there are no more records, it returns FALSE.