Documentation
¶
Index ¶
- Variables
- type Aggregate
- type Delete
- type DeleteAll
- type Expect
- type Find
- type FindAll
- type Modify
- type Preload
- type Repository
- func (r *Repository) Adapter() 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{}) error
- func (r *Repository) DeleteAll(ctx context.Context, queriers ...rel.Querier) 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() *Delete
- func (r *Repository) ExpectDeleteAll(queriers ...rel.Querier) *DeleteAll
- func (r *Repository) ExpectFind(queriers ...rel.Querier) *Find
- func (r *Repository) ExpectFindAll(queriers ...rel.Querier) *FindAll
- func (r *Repository) ExpectInsert(modifiers ...rel.Modifier) *Modify
- func (r *Repository) ExpectInsertAll() *Modify
- func (r *Repository) ExpectPreload(field string, queriers ...rel.Querier) *Preload
- func (r *Repository) ExpectTransaction(fn func(*Repository))
- func (r *Repository) ExpectUpdate(modifiers ...rel.Modifier) *Modify
- 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) Insert(ctx context.Context, record interface{}, modifiers ...rel.Modifier) error
- func (r *Repository) InsertAll(ctx context.Context, records interface{}) error
- 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{})
- func (r *Repository) MustDeleteAll(ctx context.Context, queriers ...rel.Querier)
- 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) MustInsert(ctx context.Context, record interface{}, modifiers ...rel.Modifier)
- 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{}, modifiers ...rel.Modifier)
- func (r *Repository) Ping(ctx context.Context) error
- func (r *Repository) Preload(ctx context.Context, records interface{}, field string, ...) error
- func (r *Repository) SetLogger(logger ...rel.Logger)
- func (r *Repository) Transaction(ctx context.Context, fn func(rel.Repository) error) error
- func (r *Repository) Update(ctx context.Context, record interface{}, modifiers ...rel.Modifier) 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) *Delete
ExpectDelete to be called with given field and queries.
type DeleteAll ¶
type DeleteAll struct {
*Expect
}
DeleteAll asserts and simulate delete all function for test.
func ExpectDeleteAll ¶
func ExpectDeleteAll(r *Repository, queriers []rel.Querier) *DeleteAll
ExpectDeleteAll to be called with given field and queries.
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 Modify ¶
type Modify struct {
*Expect
}
Modify asserts and simulate insert or update function for test.
func ExpectModify ¶
func ExpectModify(r *Repository, methodName string, modifiers []rel.Modifier, insertion bool) *Modify
ExpectModify to be called with given field and queries.
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() 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) Delete ¶
func (r *Repository) Delete(ctx context.Context, record interface{}) error
Delete provides a mock function with given fields: record
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() *Delete
ExpectDelete apply mocks and expectations for Delete
func (*Repository) ExpectDeleteAll ¶
func (r *Repository) ExpectDeleteAll(queriers ...rel.Querier) *DeleteAll
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) ExpectInsert ¶
func (r *Repository) ExpectInsert(modifiers ...rel.Modifier) *Modify
ExpectInsert apply mocks and expectations for Insert
func (*Repository) ExpectInsertAll ¶
func (r *Repository) ExpectInsertAll() *Modify
ExpectInsertAll records.
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(modifiers ...rel.Modifier) *Modify
ExpectUpdate apply mocks and expectations for Update
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) Insert ¶
func (r *Repository) Insert(ctx context.Context, record interface{}, modifiers ...rel.Modifier) error
Insert provides a mock function with given fields: record, modifiers
func (*Repository) InsertAll ¶
func (r *Repository) InsertAll(ctx context.Context, records interface{}) error
InsertAll records.
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{})
MustDelete provides a mock function with given fields: record
func (*Repository) MustDeleteAll ¶
func (r *Repository) MustDeleteAll(ctx context.Context, queriers ...rel.Querier)
MustDeleteAll provides a mock function with given fields: queriers
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) MustInsert ¶
func (r *Repository) MustInsert(ctx context.Context, record interface{}, modifiers ...rel.Modifier)
MustInsert provides a mock function with given fields: record, modifiers
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{}, modifiers ...rel.Modifier)
MustUpdate provides a mock function with given fields: record, modifiers
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) SetLogger ¶
func (r *Repository) SetLogger(logger ...rel.Logger)
SetLogger provides a mock function with given fields: logger
func (*Repository) Transaction ¶
func (r *Repository) Transaction(ctx context.Context, fn func(rel.Repository) error) error
Transaction provides a mock function with given fields: fn