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, _ *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 PostgreSQL.
Methods defined on the FuncProvider perform JSON (un)marshalling where appropriate to ensure a fair comparison as the mgo driver does this automatically. Ideally we'd want ot just read the data and not perform an (un)marshalling on the client side but this is a fair compromise.
func NewProvider ¶
func NewProvider(endpoint *url.URL, tableName string) (*FuncProvider, error)
NewProvider returns an instance of FuncProvider.
func (*FuncProvider) GetMaxID ¶
func (p *FuncProvider) GetMaxID() (uint64, error)
GetMaxID returns the highest ID in the table.
func (*FuncProvider) InsertRecord ¶
InsertRecord generates a new random record and inserts it with an ID provided by id.GetNew as a JSON-encoded string.
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 using jsonb_set.