random

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Data

func Data(ei *dosa.EntityInfo, minimumFields []string) map[string]dosa.FieldValue

Data generates some random data. Because our test is blackbox in a different package, we have to export this

Types

type Connector

type Connector struct{}

Connector is a connector implementation for testing

func NewConnector

func NewConnector() *Connector

NewConnector creates a new random connector

func (*Connector) CheckSchema

func (c *Connector) CheckSchema(ctx context.Context, scope, namePrefix string, ed []*dosa.EntityDefinition) (int32, error)

CheckSchema always returns a slice of int32 values that match its index

func (*Connector) CheckSchemaStatus

func (c *Connector) CheckSchemaStatus(ctx context.Context, scope, namePrefix string, version int32) (*dosa.SchemaStatus, error)

CheckSchemaStatus always returns a schema status with version 1 and ACCEPTED

func (*Connector) CreateIfNotExists

func (c *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error

CreateIfNotExists always succeeds

func (*Connector) CreateScope

func (c *Connector) CreateScope(ctx context.Context, scope string) error

CreateScope returns success

func (*Connector) DropScope

func (c *Connector) DropScope(ctx context.Context, scope string) error

DropScope returns success

func (*Connector) MultiRead

func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, values []map[string]dosa.FieldValue, minimumFields []string) ([]*dosa.FieldValuesOrError, error)

MultiRead returns a set of random data for each key you specify

func (*Connector) MultiRemove

func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) ([]error, error)

MultiRemove returns a not found error for each value

func (*Connector) MultiUpsert

func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, values []map[string]dosa.FieldValue) ([]error, error)

MultiUpsert throws away all the data you upsert, returning a set of no errors

func (*Connector) Range

func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error)

Range returns a random set of data, and a random continuation token

func (*Connector) Read

func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue, minimumFields []string) (map[string]dosa.FieldValue, error)

Read always returns random data of the type specified

func (*Connector) Remove

func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error

Remove always returns a not found error

func (*Connector) RemoveRange

func (c *Connector) RemoveRange(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition) error

RemoveRange removes all entities within the range specified by the columnConditions.

func (*Connector) Scan

func (c *Connector) Scan(ctx context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error)

Scan also returns a random set of data, like Range and Search

func (*Connector) ScopeExists

func (c *Connector) ScopeExists(ctx context.Context, scope string) (bool, error)

ScopeExists is not implemented yet

func (*Connector) Search

func (c *Connector) Search(ctx context.Context, ei *dosa.EntityInfo, fieldPairs dosa.FieldNameValuePair, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error)

Search also returns a random set of data, just like Range

func (*Connector) Shutdown

func (c *Connector) Shutdown() error

Shutdown always returns nil

func (*Connector) TruncateScope

func (c *Connector) TruncateScope(ctx context.Context, scope string) error

TruncateScope returns success

func (*Connector) Upsert

func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error

Upsert throws away the data you upsert

func (*Connector) UpsertSchema

func (c *Connector) UpsertSchema(ctx context.Context, scope, namePrefix string, ed []*dosa.EntityDefinition) (*dosa.SchemaStatus, error)

UpsertSchema always returns a slice of int32 values that match its index

Jump to

Keyboard shortcuts

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