mockmr

package
v0.0.1-78 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New(`{"error":"not_found","reason":"missing"}`)

	ErrInvalidParameters = errors.New("invalid parameters")
)

This is a list of errors we support

Functions

This section is empty.

Types

type DesignDocument

type DesignDocument struct {
	Name    string
	Indexes []*Index
}

type Engine

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

Engine represents the mock map reduce engine.

func NewEngine

func NewEngine() *Engine

NewEngine creates a new Engine

func (*Engine) DropDesignDocument

func (e *Engine) DropDesignDocument(name string) error

DropDesignDocument removes a design document.

func (*Engine) Execute

func (e *Engine) Execute(opts ExecuteOptions) (int, *ExecuteResults, error)

Execute executes a query.

func (*Engine) GetAllDesignDocuments

func (e *Engine) GetAllDesignDocuments() []*DesignDocument

GetAllDesignDocuments retrieves all design documents.

func (*Engine) GetDesignDocument

func (e *Engine) GetDesignDocument(name string) (*DesignDocument, error)

GetDesignDocument retrieves a single design document.

func (*Engine) UpsertDesignDocument

func (e *Engine) UpsertDesignDocument(name string, opts UpsertDesignDocumentOptions) error

UpsertDesignDocument creates or updates a design document.

type ExecuteOptions

type ExecuteOptions struct {
	Data      []*mockdb.Document
	DesignDoc string
	View      string

	Skip          int
	StartKey      string
	StartKeyDocID string
	EndKey        string
	EndKeyDocID   string
	InclusiveEnd  bool
	Key           string
	Keys          []string
	Descending    bool
	Reduce        bool
	Group         bool
	GroupLevel    int
	Limit         int
}

ExecuteOptions provides options when executing an query.

type ExecuteResults

type ExecuteResults struct {
	Rows []outputItem
}

ExecuteResults provides the results from an executed query.

type Index

type Index struct {
	Name       string
	MapFunc    string
	ReduceFunc string
}

Index represents a single map reduce query.

type InvalidParametersError

type InvalidParametersError struct {
	Message string
}

func (*InvalidParametersError) Error

func (ipe *InvalidParametersError) Error() string

func (*InvalidParametersError) Unwrap

func (ipe *InvalidParametersError) Unwrap() error

type UpsertDesignDocumentOptions

type UpsertDesignDocumentOptions struct {
	Indexes []*Index
}

Jump to

Keyboard shortcuts

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