Documentation ¶
Index ¶
- type FuncProvider
- func (p *FuncProvider) GetMaxID() (uint64, error)
- func (p *FuncProvider) InsertRecord(data *record.Person, id idgen.Generator, rnd *rand.Rand) bool
- func (p *FuncProvider) ReadMostRecentRecord(_ *record.Person, _ idgen.Generator, _ *rand.Rand) bool
- func (p *FuncProvider) ReadRange(_ *record.Person, _ idgen.Generator, _ *rand.Rand) bool
- func (p *FuncProvider) ReadRecord(_ *record.Person, id idgen.Generator, rnd *rand.Rand) bool
- func (p *FuncProvider) UpdateRecord(_ *record.Person, id idgen.Generator, rnd *rand.Rand) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FuncProvider ¶
FuncProvider implements dbProvider for MongoDB.
Methods are safe for concurrent use, however the struct fields are not.
func NewProvider ¶
func NewProvider(endpoint *url.URL, tableName string) (*FuncProvider, error)
NewProvider returns an instance of FuncProvider.
The following options are available in addition to the usual dial string options provided by the gmo driver:
readConcern: majority/local/linearizable writeConcern: majority/<number> journal: true/false fsync: true/false
func (*FuncProvider) GetMaxID ¶
func (p *FuncProvider) GetMaxID() (uint64, error)
GetMaxID returns the largest ID in the collection.
func (*FuncProvider) InsertRecord ¶
InsertRecord generates a new random record and inserts it with an ID provided by id.GetNew
func (*FuncProvider) ReadMostRecentRecord ¶
ReadMostRecentRecord fetches the most recently inserted record by performing a sort on the ID field, and limiting the results to a single record.
func (*FuncProvider) ReadRange ¶
ReadRange performs a range query on the age field.
THe query attempts to fetch all records where age is greater than 45 and less than 75.
func (*FuncProvider) ReadRecord ¶
ReadRecord attempts to fetch the record with an ID returned by id.GetExisting.
func (*FuncProvider) UpdateRecord ¶
UpdateRecord attempts to update the record with ID returned by id.GetExisting.
The balance field is changed to a random value from rnd.