Documentation
¶
Overview ¶
Package mock provides a basic mock for testing the datastore.
Index ¶
- type Add
- type Client
- func (c *Client) Add() client.Add
- func (c *Client) Connect() error
- func (c *Client) Filter() client.Filter
- func (c *Client) Query() client.Query
- func (c *Client) Remove() client.Remove
- func (c *Client) Transaction(ctx context.Context) (client.Transaction, error)
- func (c *Client) Update() client.Update
- type Expect
- type Filter
- func (f *Filter) And(another client.Filter) client.Filter
- func (f *Filter) BeginsWith(key string, prefix string) client.Filter
- func (f *Filter) Contains(key string, value interface{}) client.Filter
- func (f *Filter) EndsWith(key string, suffix string) client.Filter
- func (f *Filter) Eq(key string, value interface{}) client.Filter
- func (f *Filter) Gt(key string, value interface{}) client.Filter
- func (f *Filter) Lt(key string, value interface{}) client.Filter
- func (f *Filter) NotContains(key string, value interface{}) client.Filter
- func (f *Filter) NotEq(key string, value interface{}) client.Filter
- func (f *Filter) Or(another client.Filter) client.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 *time.Time) client.Query
- func (q *Query) And(collection string, args ...interface{}) client.Query
- func (q *Query) Execute(ctx context.Context, dst interface{}) error
- func (q *Query) Filter(filter client.Filter) client.Query
- func (q *Query) First(first int) client.Query
- func (q *Query) From(collection string) client.Query
- func (q *Query) Order(by string) client.Query
- func (q *Query) Return(key string, args ...interface{}) client.Query
- func (q *Query) Secondary() client.Query
- func (q *Query) Statement() (string, []interface{}, error)
- type Remove
- func (r *Remove) After(key string, value *time.Time) client.Remove
- func (r *Remove) Execute(ctx context.Context) (int, error)
- func (r *Remove) Filter(filter client.Filter) client.Remove
- func (r *Remove) First(first int) client.Remove
- func (r *Remove) From(collection string) client.Remove
- func (r *Remove) Order(by string) client.Remove
- func (r *Remove) Statement() (string, []interface{}, error)
- type Transaction
- type Update
- func (u *Update) Execute(ctx context.Context) (int, error)
- func (u *Update) Filter(filter client.Filter) client.Update
- func (u *Update) In(collection string) client.Update
- func (u *Update) Item(snapshot map[string]interface{}) client.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
type Client ¶ added in v0.0.2
type Client struct {
Mock
// contains filtered or unexported fields
}
Client is a mock datastore.Client
func NewDisconnectedClient ¶ added in v0.0.2
NewDisconnectedClient creates a new disconnected mock store
func (*Client) Transaction ¶ added in v0.0.2
type Filter ¶
type Filter struct {
Mock
// contains filtered or unexported fields
}
Filter is a mock datastore.Filter
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
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 (*Transaction) Commit ¶
func (tx *Transaction) Commit() error
func (*Transaction) Rollback ¶
func (tx *Transaction) Rollback() error
Click to show internal directories.
Click to hide internal directories.