mock

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mock provides a basic mock for testing the datastore.

Index

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 NewAdd

func NewAdd(t *testing.T) *Add

NewAdd creates a mock datastore.Add

func (*Add) Execute

func (a *Add) Execute(ctx context.Context) (int, error)

func (*Add) Item

func (a *Add) Item(value map[string]interface{}) client.Add

func (*Add) Query

func (a *Add) Query(query client.Query) client.Add

func (*Add) Statement

func (a *Add) Statement() (string, []interface{}, error)

func (*Add) To

func (a *Add) To(collection string) client.Add

type Client added in v0.0.2

type Client struct {
	Mock
	// contains filtered or unexported fields
}

Client is a mock datastore.Client

func NewClient added in v0.0.2

func NewClient(t *testing.T) *Client

NewClient creates a connected mock store

func NewDisconnectedClient added in v0.0.2

func NewDisconnectedClient(t *testing.T) *Client

NewDisconnectedClient creates a new disconnected mock store

func (*Client) Add added in v0.0.2

func (c *Client) Add() client.Add

func (*Client) Connect added in v0.0.2

func (c *Client) Connect() error

func (*Client) Filter added in v0.0.2

func (c *Client) Filter() client.Filter

func (*Client) Query added in v0.0.2

func (c *Client) Query() client.Query

func (*Client) Remove added in v0.0.2

func (c *Client) Remove() client.Remove

func (*Client) Transaction added in v0.0.2

func (c *Client) Transaction(ctx context.Context) (client.Transaction, error)

func (*Client) Update added in v0.0.2

func (c *Client) Update() client.Update

type Expect

type Expect struct {
	// contains filtered or unexported fields
}

func (*Expect) Return

func (e *Expect) Return(output ...interface{})

type Filter

type Filter struct {
	Mock
	// contains filtered or unexported fields
}

Filter is a mock datastore.Filter

func NewFilter

func NewFilter(t *testing.T) *Filter

NewFilter creates a mock datastore.Filter

func (*Filter) And

func (f *Filter) And(another client.Filter) client.Filter

func (*Filter) BeginsWith

func (f *Filter) BeginsWith(key string, prefix string) client.Filter

func (*Filter) Contains

func (f *Filter) Contains(key string, value interface{}) client.Filter

func (*Filter) EndsWith

func (f *Filter) EndsWith(key string, suffix string) client.Filter

func (*Filter) Eq

func (f *Filter) Eq(key string, value interface{}) client.Filter

func (*Filter) Gt

func (f *Filter) Gt(key string, value interface{}) client.Filter

func (*Filter) Lt

func (f *Filter) Lt(key string, value interface{}) client.Filter

func (*Filter) NotContains

func (f *Filter) NotContains(key string, value interface{}) client.Filter

func (*Filter) NotEq

func (f *Filter) NotEq(key string, value interface{}) client.Filter

func (*Filter) Or

func (f *Filter) Or(another client.Filter) client.Filter

type Mock

type Mock struct {
	// contains filtered or unexported fields
}

func (*Mock) Assert

func (m *Mock) Assert(t *testing.T)

func (*Mock) Call

func (m *Mock) Call(t *testing.T, args ...interface{}) []interface{}

func (*Mock) Expect

func (m *Mock) Expect(funcName string, args ...interface{}) *Expect

func (*Mock) Fatal

func (m *Mock) Fatal(t *testing.T, args ...interface{})

func (*Mock) Fatalf

func (m *Mock) Fatalf(t *testing.T, format string, args ...interface{})

type Query

type Query struct {
	Mock
	// contains filtered or unexported fields
}

Query is a mock datastore.Query

func NewQuery

func NewQuery(t *testing.T) *Query

NewQuery creates a mock datastore.Query

func NewQueryWithFail

func NewQueryWithFail(t *testing.T, expect ...interface{}) *Query

NewQueryWithFail creates a mock datastore.Query with an expected failure

func (*Query) After

func (q *Query) After(key string, value *time.Time) client.Query

func (*Query) And

func (q *Query) And(collection string, args ...interface{}) client.Query

func (*Query) Execute

func (q *Query) Execute(ctx context.Context, dst interface{}) error

func (*Query) Filter

func (q *Query) Filter(filter client.Filter) client.Query

func (*Query) First

func (q *Query) First(first int) client.Query

func (*Query) From

func (q *Query) From(collection string) client.Query

func (*Query) Order

func (q *Query) Order(by string) client.Query

func (*Query) Return

func (q *Query) Return(key string, args ...interface{}) client.Query

func (*Query) Secondary

func (q *Query) Secondary() client.Query

func (*Query) Statement

func (q *Query) Statement() (string, []interface{}, error)

type Remove

type Remove struct {
	Mock
	// contains filtered or unexported fields
}

Remove is a mock datastore.Remove

func NewRemove

func NewRemove(t *testing.T) *Remove

NewRemove creates a mock datastore.Remove

func (*Remove) After

func (r *Remove) After(key string, value *time.Time) client.Remove

func (*Remove) Execute

func (r *Remove) Execute(ctx context.Context) (int, error)

func (*Remove) Filter

func (r *Remove) Filter(filter client.Filter) client.Remove

func (*Remove) First

func (r *Remove) First(first int) client.Remove

func (*Remove) From

func (r *Remove) From(collection string) client.Remove

func (*Remove) Order

func (r *Remove) Order(by string) client.Remove

func (*Remove) Statement

func (r *Remove) Statement() (string, []interface{}, error)

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) Execute

func (tx *Transaction) Execute(statement client.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 NewUpdate

func NewUpdate(t *testing.T) *Update

NewUpdate creates a mock datastore.Update

func (*Update) Execute

func (u *Update) Execute(ctx context.Context) (int, error)

func (*Update) Filter

func (u *Update) Filter(filter client.Filter) client.Update

func (*Update) In

func (u *Update) In(collection string) client.Update

func (*Update) Item

func (u *Update) Item(snapshot map[string]interface{}) client.Update

func (*Update) Statement

func (u *Update) Statement() (string, []interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL