dsfake

package
v0.1.73 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dsfake implements a fake dsiface.Client If you make changes to existing code, please test whether it breaks existing clients, e.g. in etl-gardener.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("Not implemented")

ErrNotImplemented is returned if a dsiface function is unimplemented.

Functions

This section is empty.

Types

type Client

type Client struct {
	dsiface.Client // For unimplemented methods
	// contains filtered or unexported fields
}

Client implements a crude datastore test client. It is somewhat simplistic and incomplete. It works only for basic Put, Get, and Delete, but may not always work correctly.

func NewClient

func NewClient() *Client

NewClient returns a fake client that satisfies dsiface.Client.

func (*Client) Close

func (c *Client) Close() error

Close implements dsiface.Client.Close

func (*Client) Count

func (c *Client) Count(ctx context.Context, q *datastore.Query) (n int, err error)

Count implements dsiface.Client.Count

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key *datastore.Key) error

Delete implements dsiface.Client.Delete

func (*Client) Get

func (c *Client) Get(ctx context.Context, key *datastore.Key, dst interface{}) (err error)

Get implements dsiface.Client.Get

func (*Client) GetKeys

func (c *Client) GetKeys() []datastore.Key

GetKeys lists all keys saved in the fake client.

func (*Client) Put

func (c *Client) Put(ctx context.Context, key *datastore.Key, src interface{}) (*datastore.Key, error)

Put mplements dsiface.Client.Put

Jump to

Keyboard shortcuts

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