testutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayValue

func ArrayValue(a document.Array) expr.LiteralValue

ArrayValue creates a litteral value of type Array.

func BlobValue

func BlobValue(v []byte) expr.LiteralValue

BlobValue creates a litteral value of type Blob.

func BoolValue

func BoolValue(v bool) expr.LiteralValue

BoolValue creates a litteral value of type Bool.

func DocumentValue

func DocumentValue(d document.Document) expr.LiteralValue

DocumentValue creates a litteral value of type Document.

func DoubleValue

func DoubleValue(v float64) expr.LiteralValue

DoubleValue creates a litteral value of type Double.

func Dump

func Dump(t testing.TB, v interface{})

Dump a json representation of v to os.Stdout.

func Exec

func Exec(tx *database.Transaction, q string, params ...expr.Param) error

func ExprRunner

func ExprRunner(t *testing.T, testfile string)

func IntegerValue

func IntegerValue(v int64) expr.LiteralValue

IntegerValue creates a litteral value of type Integer.

func IteratorToJSONArray

func IteratorToJSONArray(w io.Writer, s document.Iterator) error

IteratorToJSONArray encodes all the documents of an iterator to a JSON array.

func MakeArray

func MakeArray(t testing.TB, jsonArray string) document.Array

MakeArray creates an array from a json string.

func MakeArrayValue

func MakeArrayValue(t testing.TB, vs ...interface{}) document.Value

func MakeDocument

func MakeDocument(t testing.TB, jsonDoc string) document.Document

MakeDocument creates a document from a json string.

func MakeValue

func MakeValue(t testing.TB, v interface{}) document.Value

MakeValue turns v into a document.Value.

func MakeValueBuffer

func MakeValueBuffer(t testing.TB, jsonArray string) *document.ValueBuffer

func MustExec

func MustExec(t *testing.T, tx *database.Transaction, q string, params ...expr.Param)

func MustQuery

func MustQuery(t *testing.T, tx *database.Transaction, q string, params ...expr.Param) *query.Result

func NewTestDB

func NewTestDB(t testing.TB) (*database.Database, func())

func NewTestTx

func NewTestTx(t testing.TB) (*database.Database, *database.Transaction, func())

func NullValue

func NullValue() expr.LiteralValue

NullValue creates a litteral value of type Null.

func ParseDocumentPath

func ParseDocumentPath(t testing.TB, p string) document.Path

func ParseNamedExpr

func ParseNamedExpr(t testing.TB, s string, name ...string) expr.Expr

func ParsePath

func ParsePath(t testing.TB, p string) expr.Path

func Query

func Query(tx *database.Transaction, q string, params ...expr.Param) (*query.Result, error)

func RequireDocEqual

func RequireDocEqual(t testing.TB, d1, d2 document.Document)

func RequireDocJSONEq

func RequireDocJSONEq(t testing.TB, d document.Document, expected string)

func RequireStreamEq

func RequireStreamEq(t *testing.T, raw string, res *genji.Result)

func TextValue

func TextValue(v string) expr.LiteralValue

TextValue creates a litteral value of type Text.

Types

type Docs

type Docs []document.Document

func MakeDocuments

func MakeDocuments(t testing.TB, jsonDocs ...string) (docs Docs)

MakeDocuments creates a slice of document from json strings.

func (Docs) RequireEqual

func (docs Docs) RequireEqual(t testing.TB, others Docs)

type KV

type KV struct {
	Key, Value []byte
}

KV is used to represent key-value pairs stored in tables or indexes.

func GetIndexContent

func GetIndexContent(t testing.TB, tx *database.Transaction, indexName string) []KV

GetIndexContent iterates over the entire index and returns all the key-value pairs in order.

type ResultStream

type ResultStream struct {
	*parser.Parser
	// contains filtered or unexported fields
}

func ParseResultStream

func ParseResultStream(stream string) *ResultStream

func (*ResultStream) Next

func (ds *ResultStream) Next() (*document.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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