testutil

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayValue

func ArrayValue(a types.Array) expr.LiteralValue

ArrayValue creates a literal value of type Array.

func BlobValue

func BlobValue(v []byte) expr.LiteralValue

BlobValue creates a literal value of type Blob.

func BoolValue

func BoolValue(v bool) expr.LiteralValue

BoolValue creates a literal value of type Bool.

func CloneDocument added in v0.14.0

func CloneDocument(t testing.TB, d types.Document) *document.FieldBuffer

func DocumentValue

func DocumentValue(d types.Document) expr.LiteralValue

DocumentValue creates a literal value of type Document.

func DoubleValue

func DoubleValue(v float64) expr.LiteralValue

DoubleValue creates a literal value of type Double.

func Dump

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

Dump a json representation of v to os.Stdout.

func DumpPebble added in v0.15.0

func DumpPebble(t testing.TB, pdb *pebble.DB)

func Exec

func Exec(db *database.Database, tx *database.Transaction, q string, params ...environment.Param) error

func ExprList

func ExprList(t testing.TB, s string) expr.LiteralExprList

func ExprRunner

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

func FunctionExpr

func FunctionExpr(t testing.TB, name string, args ...expr.Expr) expr.Expr

func Int64Ptr

func Int64Ptr(n int64) *int64

func IntegerValue

func IntegerValue(v int64) expr.LiteralValue

IntegerValue creates a literal 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) types.Array

MakeArray creates an array from a json string.

func MakeArrayValue

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

func MakeDocument

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

MakeDocument creates a document from a json string.

func MakeValue

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

MakeValue turns v into a types.Value.

func MakeValueBuffer

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

func MustExec

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

func MustQuery

func MustQuery(t *testing.T, db *database.Database, tx *database.Transaction, q string, params ...environment.Param) *statement.Result

func NewKey added in v0.14.0

func NewKey(t testing.TB, values ...types.Value) *tree.Key

func NewMemPebble added in v0.15.0

func NewMemPebble(t testing.TB) *pebble.DB

func NewPebble added in v0.15.0

func NewPebble(t testing.TB) *pebble.DB

func NewTestDB

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

func NewTestDBWithPebble added in v0.15.0

func NewTestDBWithPebble(t testing.TB, pdb *pebble.DB) *database.Database

func NewTestTree added in v0.15.0

func NewTestTree(t testing.TB, namespace tree.Namespace) *tree.Tree

func NewTestTx

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

func NullValue

func NullValue() expr.LiteralValue

NullValue creates a literal value of type Null.

func ParseDocumentPath

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

func ParseDocumentPaths added in v0.14.0

func ParseDocumentPaths(t testing.TB, str ...string) []document.Path

func ParseExpr added in v0.14.0

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

func ParseExprs added in v0.15.0

func ParseExprs(t testing.TB, s ...string) []expr.Expr

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 RequireArrayEqual added in v0.15.0

func RequireArrayEqual(t testing.TB, want, got types.Array)

func RequireDocEqual

func RequireDocEqual(t testing.TB, want, got types.Document)

func RequireDocJSONEq

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

func RequireStreamEq

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

func RequireStreamEqf added in v0.14.0

func RequireStreamEqf(t *testing.T, raw string, res *genji.Result, sorted bool, msg string, args ...interface{})

func TempDir added in v0.15.0

func TempDir(t testing.TB) string

func TestExpr

func TestExpr(t testing.TB, exprStr string, env *environment.Environment, want types.Value, fails bool)

func TextValue

func TextValue(v string) expr.LiteralValue

TextValue creates a literal value of type Text.

Types

type Docs

type Docs []types.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 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() (types.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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