Documentation
¶
Overview ¶
Package mock provides a basic mock for testing the datastore.
Index ¶
- type Add
- type Cursor
- type Expect
- type Filter
- func (f *Filter) And(another datastore.Filter) datastore.Filter
- func (f *Filter) BeginsWith(key string, prefix string) datastore.Filter
- func (f *Filter) Contains(key string, value interface{}) datastore.Filter
- func (f *Filter) EndsWith(key string, suffix string) datastore.Filter
- func (f *Filter) Eq(key string, value interface{}) datastore.Filter
- func (f *Filter) Gt(key string, value interface{}) datastore.Filter
- func (f *Filter) Lt(key string, value interface{}) datastore.Filter
- func (f *Filter) NotContains(key string, value interface{}) datastore.Filter
- func (f *Filter) NotEq(key string, value interface{}) datastore.Filter
- func (f *Filter) Or(another datastore.Filter) datastore.Filter
- type Mock
- func (m *Mock) Assert(t *testing.T)
- func (m *Mock) Call(t *testing.T, args ...interface{}) []interface{}
- func (m *Mock) Expect(funcName string, args ...interface{}) *Expect
- func (m *Mock) Fatal(t *testing.T, args ...interface{})
- func (m *Mock) Fatalf(t *testing.T, format string, args ...interface{})
- type Query
- func (q *Query) After(key string, value interface{}) datastore.Query
- func (q *Query) And(collection string, args ...interface{}) datastore.Query
- func (q *Query) Execute(ctx context.Context) (datastore.Cursor, error)
- func (q *Query) Filter(filter datastore.Filter) datastore.Query
- func (q *Query) First(first int) datastore.Query
- func (q *Query) From(collection string) datastore.Query
- func (q *Query) Order(by string) datastore.Query
- func (q *Query) Return(key string, args ...interface{}) datastore.Query
- func (q *Query) Secondary() datastore.Query
- func (q *Query) Statement() (string, []interface{}, error)
- type Remove
- func (r *Remove) After(key string, value interface{}) datastore.Remove
- func (r *Remove) Execute(ctx context.Context) (int, error)
- func (r *Remove) Filter(filter datastore.Filter) datastore.Remove
- func (r *Remove) First(first int) datastore.Remove
- func (r *Remove) From(collection string) datastore.Remove
- func (r *Remove) Order(by string) datastore.Remove
- func (r *Remove) Statement() (string, []interface{}, error)
- type Snapper
- type Store
- func (s *Store) Add() datastore.Add
- func (s *Store) Connect() error
- func (s *Store) Filter() datastore.Filter
- func (s *Store) Query() datastore.Query
- func (s *Store) Remove() datastore.Remove
- func (s *Store) Transaction(ctx context.Context) (datastore.Transaction, error)
- func (s *Store) Update() datastore.Update
- type Transaction
- type Update
- func (u *Update) Execute(ctx context.Context) (int, error)
- func (u *Update) Filter(filter datastore.Filter) datastore.Update
- func (u *Update) In(collection string) datastore.Update
- func (u *Update) Item(snapshot map[string]interface{}) datastore.Update
- func (u *Update) Statement() (string, []interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Add ¶
type Add struct {
Mock
// contains filtered or unexported fields
}
Add is a mock datastore.Add
func NewAddWithFail ¶
NewAddWithFail creates a mock datastore.Add with an expected failure
type Cursor ¶
type Cursor struct {
Mock
// contains filtered or unexported fields
}
func NewCursorWithFail ¶
NewCursorWithFail creates a mock datastore.Cursor with an expected failure
type Filter ¶
type Filter struct {
Mock
// contains filtered or unexported fields
}
Filter is a mock datastore.Filter
func NewFilterWithFail ¶
NewFilterWithFail creates a mock datastore.Filter with an expected failure
func (*Filter) NotContains ¶
type Query ¶
type Query struct {
Mock
// contains filtered or unexported fields
}
Query is a mock datastore.Query
func NewQueryWithFail ¶
NewQueryWithFail creates a mock datastore.Query with an expected failure
type Remove ¶
type Remove struct {
Mock
// contains filtered or unexported fields
}
Remove is a mock datastore.Remove
func NewRemoveWithFail ¶
NewRemoveWithFail creates a mock datastore.Remove with an expected failure
type Snapper ¶
type Snapper struct {
Mock
// contains filtered or unexported fields
}
Snapper is a mock datastore.Snapper
func NewSnapperWithFail ¶
NewSnapperWithFail creates a mock datastore.Snapper with an expected failure
type Store ¶
type Store struct {
Mock
// contains filtered or unexported fields
}
Store is a mock datastore.Client
func NewDisconnectedStore ¶
NewDisconnectedStore creates a new disconnected mock store
func NewDisconnectedStoreWithFail ¶
NewDisconnectedStoreWithFail creates a disconnected store with an expected failure
func (*Store) Transaction ¶
type Transaction ¶
type Transaction struct {
Mock
// contains filtered or unexported fields
}
Transaction is a mock datastore.Transaction
func NewTransaction ¶
func NewTransaction(t *testing.T) *Transaction
NewTransaction creates a mock datastore.Transaction
func NewTransactionWithFail ¶
func NewTransactionWithFail(t *testing.T, expect ...interface{}) *Transaction
NewTransactionWithFail creates a mock datastore.Transaction with an expected failure
func (*Transaction) Commit ¶
func (tx *Transaction) Commit() error
func (*Transaction) Execute ¶
func (tx *Transaction) Execute(statement datastore.Encoder) (int, error)
func (*Transaction) Rollback ¶
func (tx *Transaction) Rollback() error
type Update ¶
type Update struct {
Mock
// contains filtered or unexported fields
}
Update is a mock datastore.Update
func NewUpdateWithFail ¶
NewUpdateWithFail creates a mock datastore.Update with an expected failure