Documentation
¶
Index ¶
- Variables
- type Aggregate
- type Delete
- type Expect
- type Find
- type FindAll
- type FindAndCountAll
- type Iterate
- type Mutate
- type MutateAll
- type Preload
- type Repository
- func (r *Repository) Adapter(ctx context.Context) rel.Adapter
- func (r *Repository) Aggregate(ctx context.Context, query rel.Query, aggregate string, field string) (int, error)
- func (r *Repository) AssertExpectations(t *testing.T) bool
- func (r *Repository) Count(ctx context.Context, collection string, queriers ...rel.Querier) (int, error)
- func (r *Repository) Delete(ctx context.Context, record interface{}, options ...rel.Cascade) error
- func (r *Repository) DeleteAll(ctx context.Context, query rel.Query) error
- func (r *Repository) ExpectAggregate(query rel.Query, aggregate string, field string) *Aggregate
- func (r *Repository) ExpectCount(collection string, queriers ...rel.Querier) *Aggregate
- func (r *Repository) ExpectDelete(options ...rel.Cascade) *Delete
- func (r *Repository) ExpectDeleteAll(query rel.Query) *MutateAll
- func (r *Repository) ExpectFind(queriers ...rel.Querier) *Find
- func (r *Repository) ExpectFindAll(queriers ...rel.Querier) *FindAll
- func (r *Repository) ExpectFindAndCountAll(queriers ...rel.Querier) *FindAndCountAll
- func (r *Repository) ExpectInsert(mutators ...rel.Mutator) *Mutate
- func (r *Repository) ExpectInsertAll() *Mutate
- func (r *Repository) ExpectIterate(query rel.Query, options ...rel.IteratorOption) *Iterate
- func (r *Repository) ExpectPreload(field string, queriers ...rel.Querier) *Preload
- func (r *Repository) ExpectTransaction(fn func(*Repository))
- func (r *Repository) ExpectUpdate(mutators ...rel.Mutator) *Mutate
- func (r *Repository) ExpectUpdateAll(query rel.Query, mutates ...rel.Mutate) *MutateAll
- func (r *Repository) Find(ctx context.Context, record interface{}, queriers ...rel.Querier) error
- func (r *Repository) FindAll(ctx context.Context, records interface{}, queriers ...rel.Querier) error
- func (r *Repository) FindAndCountAll(ctx context.Context, records interface{}, queriers ...rel.Querier) (int, error)
- func (r *Repository) Insert(ctx context.Context, record interface{}, mutators ...rel.Mutator) error
- func (r *Repository) InsertAll(ctx context.Context, records interface{}) error
- func (r *Repository) Instrumentation(instrumenter rel.Instrumenter)
- func (r *Repository) Iterate(ctx context.Context, query rel.Query, options ...rel.IteratorOption) rel.Iterator
- func (r *Repository) MustAggregate(ctx context.Context, query rel.Query, aggregate string, field string) int
- func (r *Repository) MustCount(ctx context.Context, collection string, queriers ...rel.Querier) int
- func (r *Repository) MustDelete(ctx context.Context, record interface{}, options ...rel.Cascade)
- func (r *Repository) MustDeleteAll(ctx context.Context, query rel.Query)
- func (r *Repository) MustFind(ctx context.Context, record interface{}, queriers ...rel.Querier)
- func (r *Repository) MustFindAll(ctx context.Context, records interface{}, queriers ...rel.Querier)
- func (r *Repository) MustFindAndCountAll(ctx context.Context, records interface{}, queriers ...rel.Querier) int
- func (r *Repository) MustInsert(ctx context.Context, record interface{}, mutators ...rel.Mutator)
- func (r *Repository) MustInsertAll(ctx context.Context, records interface{})
- func (r *Repository) MustPreload(ctx context.Context, records interface{}, field string, ...)
- func (r *Repository) MustUpdate(ctx context.Context, record interface{}, mutators ...rel.Mutator)
- func (r *Repository) MustUpdateAll(ctx context.Context, query rel.Query, mutates ...rel.Mutate)
- func (r *Repository) Ping(ctx context.Context) error
- func (r *Repository) Preload(ctx context.Context, records interface{}, field string, ...) error
- func (r *Repository) Transaction(ctx context.Context, fn func(ctx context.Context) error) error
- func (r *Repository) Update(ctx context.Context, record interface{}, mutators ...rel.Mutator) error
- func (r *Repository) UpdateAll(ctx context.Context, query rel.Query, mutates ...rel.Mutate) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrConnectionClosed is alias for sql.ErrConnDone. ErrConnectionClosed = sql.ErrConnDone )
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate struct {
*Expect
}
Aggregate asserts and simulate aggregate function for test.
func ExpectAggregate ¶
ExpectAggregate to be called with given field and queries.
func ExpectCount ¶
func ExpectCount(r *Repository, collection string, queriers []rel.Querier) *Aggregate
ExpectCount to be called with given field and queries.
func (*Aggregate) ConnectionClosed ¶
func (a *Aggregate) ConnectionClosed()
ConnectionClosed sets this error to be returned.
type Delete ¶
type Delete struct {
*Expect
}
Delete asserts and simulate delete function for test.
func ExpectDelete ¶
func ExpectDelete(r *Repository, options []rel.Cascade) *Delete
ExpectDelete to be called.
type Expect ¶
Expect is base behaviour for all reltest expectations.
func (*Expect) ConnectionClosed ¶
func (e *Expect) ConnectionClosed()
ConnectionClosed sets this error to be returned.
type Find ¶
type Find struct {
*FindAll
}
Find asserts and simulate find function for test.
func ExpectFind ¶
func ExpectFind(r *Repository, queriers []rel.Querier) *Find
ExpectFind to be called with given field and queries.
type FindAll ¶
type FindAll struct {
*Expect
}
FindAll asserts and simulate find all function for test.
func ExpectFindAll ¶
func ExpectFindAll(r *Repository, queriers []rel.Querier) *FindAll
ExpectFindAll to be called with given field and queries.
type FindAndCountAll ¶ added in v0.3.0
type FindAndCountAll struct {
*Expect
}
FindAndCountAll asserts and simulate find all function for test.
func ExpectFindAndCountAll ¶ added in v0.3.0
func ExpectFindAndCountAll(r *Repository, queriers []rel.Querier) *FindAndCountAll
ExpectFindAndCountAll to be called with given field and queries.
func (*FindAndCountAll) ConnectionClosed ¶ added in v0.3.0
func (fa *FindAndCountAll) ConnectionClosed()
ConnectionClosed sets this error to be returned.
func (*FindAndCountAll) Error ¶ added in v0.3.0
func (fa *FindAndCountAll) Error(err error)
Error sets error to be returned.
func (*FindAndCountAll) Result ¶ added in v0.3.0
func (fa *FindAndCountAll) Result(records interface{}, count int)
Result sets the result of this query.
type Iterate ¶ added in v0.3.0
type Iterate iterator
Iterate asserts and simulate iterate function for test.
func ExpectIterate ¶ added in v0.3.0
func ExpectIterate(r *Repository, query rel.Query, options []rel.IteratorOption) *Iterate
ExpectIterate to be called.
func (*Iterate) ConnectionClosed ¶ added in v0.3.0
func (i *Iterate) ConnectionClosed()
ConnectionClosed sets this error to be returned.
type Mutate ¶ added in v0.4.0
type Mutate struct {
*Expect
}
Mutate asserts and simulate insert or update function for test.
func ExpectInsert ¶ added in v0.3.0
func ExpectInsert(r *Repository, mutators []rel.Mutator) *Mutate
ExpectInsert to be called with given field and queries.
func ExpectUpdate ¶ added in v0.3.0
func ExpectUpdate(r *Repository, mutators []rel.Mutator) *Mutate
ExpectUpdate to be called with given field and queries.
type MutateAll ¶ added in v0.5.0
type MutateAll struct {
*Expect
}
MutateAll asserts and simulate mutate all function for test.
func ExpectDeleteAll ¶
func ExpectDeleteAll(r *Repository, query rel.Query) *MutateAll
ExpectDeleteAll to be called.
func ExpectUpdateAll ¶ added in v0.5.0
ExpectUpdateAll to be called.
type Preload ¶
type Preload struct {
*Expect
}
Preload asserts and simulate preload function for test.
func ExpectPreload ¶
func ExpectPreload(r *Repository, field string, queriers []rel.Querier) *Preload
ExpectPreload to be called with given field and queries.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is an autogenerated mock type for the Repository type
func (*Repository) Adapter ¶
func (r *Repository) Adapter(ctx context.Context) rel.Adapter
Adapter provides a mock function with given fields:
func (*Repository) Aggregate ¶
func (r *Repository) Aggregate(ctx context.Context, query rel.Query, aggregate string, field string) (int, error)
Aggregate provides a mock function with given fields: query, aggregate, field
func (*Repository) AssertExpectations ¶
func (r *Repository) AssertExpectations(t *testing.T) bool
AssertExpectations asserts that everything was in fact called as expected. Calls may have occurred in any order.
func (*Repository) Count ¶
func (r *Repository) Count(ctx context.Context, collection string, queriers ...rel.Querier) (int, error)
Count provides a mock function with given fields: collection, queriers
func (*Repository) ExpectAggregate ¶
ExpectAggregate apply mocks and expectations for Aggregate
func (*Repository) ExpectCount ¶
func (r *Repository) ExpectCount(collection string, queriers ...rel.Querier) *Aggregate
ExpectCount apply mocks and expectations for Count
func (*Repository) ExpectDelete ¶
func (r *Repository) ExpectDelete(options ...rel.Cascade) *Delete
ExpectDelete apply mocks and expectations for Delete
func (*Repository) ExpectDeleteAll ¶
func (r *Repository) ExpectDeleteAll(query rel.Query) *MutateAll
ExpectDeleteAll apply mocks and expectations for DeleteAll
func (*Repository) ExpectFind ¶
func (r *Repository) ExpectFind(queriers ...rel.Querier) *Find
ExpectFind apply mocks and expectations for Find
func (*Repository) ExpectFindAll ¶
func (r *Repository) ExpectFindAll(queriers ...rel.Querier) *FindAll
ExpectFindAll apply mocks and expectations for FindAll
func (*Repository) ExpectFindAndCountAll ¶ added in v0.3.0
func (r *Repository) ExpectFindAndCountAll(queriers ...rel.Querier) *FindAndCountAll
ExpectFindAndCountAll apply mocks and expectations for FindAndCountAll
func (*Repository) ExpectInsert ¶
func (r *Repository) ExpectInsert(mutators ...rel.Mutator) *Mutate
ExpectInsert apply mocks and expectations for Insert
func (*Repository) ExpectInsertAll ¶
func (r *Repository) ExpectInsertAll() *Mutate
ExpectInsertAll records.
func (*Repository) ExpectIterate ¶ added in v0.3.0
func (r *Repository) ExpectIterate(query rel.Query, options ...rel.IteratorOption) *Iterate
ExpectIterate apply mocks and expectations for Iterate
func (*Repository) ExpectPreload ¶
func (r *Repository) ExpectPreload(field string, queriers ...rel.Querier) *Preload
ExpectPreload apply mocks and expectations for Preload
func (*Repository) ExpectTransaction ¶
func (r *Repository) ExpectTransaction(fn func(*Repository))
ExpectTransaction declare expectation inside transaction.
func (*Repository) ExpectUpdate ¶
func (r *Repository) ExpectUpdate(mutators ...rel.Mutator) *Mutate
ExpectUpdate apply mocks and expectations for Update
func (*Repository) ExpectUpdateAll ¶ added in v0.5.0
ExpectUpdateAll apply mocks and expectations for UpdateAll
func (*Repository) FindAll ¶
func (r *Repository) FindAll(ctx context.Context, records interface{}, queriers ...rel.Querier) error
FindAll provides a mock function with given fields: records, queriers
func (*Repository) FindAndCountAll ¶ added in v0.3.0
func (r *Repository) FindAndCountAll(ctx context.Context, records interface{}, queriers ...rel.Querier) (int, error)
FindAndCountAll provides a mock function with given fields: records, queriers
func (*Repository) InsertAll ¶
func (r *Repository) InsertAll(ctx context.Context, records interface{}) error
InsertAll records.
func (*Repository) Instrumentation ¶ added in v0.3.0
func (r *Repository) Instrumentation(instrumenter rel.Instrumenter)
Instrumentation provides a mock function with given fields: instrumenter
func (*Repository) Iterate ¶ added in v0.3.0
func (r *Repository) Iterate(ctx context.Context, query rel.Query, options ...rel.IteratorOption) rel.Iterator
Iterate through a collection of records from database in batches. This function returns iterator that can be used to loop all records. Limit, Offset and Sort query is automatically ignored.
func (*Repository) MustAggregate ¶
func (r *Repository) MustAggregate(ctx context.Context, query rel.Query, aggregate string, field string) int
MustAggregate provides a mock function with given fields: query, aggregate, field
func (*Repository) MustCount ¶
MustCount provides a mock function with given fields: collection, queriers
func (*Repository) MustDelete ¶
func (r *Repository) MustDelete(ctx context.Context, record interface{}, options ...rel.Cascade)
MustDelete provides a mock function with given fields: record
func (*Repository) MustDeleteAll ¶
func (r *Repository) MustDeleteAll(ctx context.Context, query rel.Query)
MustDeleteAll provides a mock function with given fields: query
func (*Repository) MustFind ¶
func (r *Repository) MustFind(ctx context.Context, record interface{}, queriers ...rel.Querier)
MustFind provides a mock function with given fields: record, queriers
func (*Repository) MustFindAll ¶
func (r *Repository) MustFindAll(ctx context.Context, records interface{}, queriers ...rel.Querier)
MustFindAll provides a mock function with given fields: records, queriers
func (*Repository) MustFindAndCountAll ¶ added in v0.3.0
func (r *Repository) MustFindAndCountAll(ctx context.Context, records interface{}, queriers ...rel.Querier) int
MustFindAndCountAll provides a mock function with given fields: records, queriers
func (*Repository) MustInsert ¶
func (r *Repository) MustInsert(ctx context.Context, record interface{}, mutators ...rel.Mutator)
MustInsert provides a mock function with given fields: record, mutators
func (*Repository) MustInsertAll ¶
func (r *Repository) MustInsertAll(ctx context.Context, records interface{})
MustInsertAll records.
func (*Repository) MustPreload ¶
func (r *Repository) MustPreload(ctx context.Context, records interface{}, field string, queriers ...rel.Querier)
MustPreload provides a mock function with given fields: records, field, queriers
func (*Repository) MustUpdate ¶
func (r *Repository) MustUpdate(ctx context.Context, record interface{}, mutators ...rel.Mutator)
MustUpdate provides a mock function with given fields: record, mutators
func (*Repository) MustUpdateAll ¶ added in v0.5.0
MustUpdateAll provides a mock function with given fields: query
func (*Repository) Ping ¶ added in v0.2.0
func (r *Repository) Ping(ctx context.Context) error
Ping database.
func (*Repository) Preload ¶
func (r *Repository) Preload(ctx context.Context, records interface{}, field string, queriers ...rel.Querier) error
Preload provides a mock function with given fields: records, field, queriers
func (*Repository) Transaction ¶
Transaction provides a mock function with given fields: fn