queries

package
v0.0.0-...-1beb280 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEntityByID

func GetEntityByID(executor QueryExecutor, collectionName string, id string) (map[string][]map[string]interface{}, error)

GetEntityByID queries the specified collection for the given id

Types

type ArangoDbQueryExecutor

type ArangoDbQueryExecutor struct {
	QueryExecutor
	// contains filtered or unexported fields
}

ArangoDbQueryExecutor is the primary type for executing queries

func NewQueryExecutor

func NewQueryExecutor() ArangoDbQueryExecutor

NewQueryExecutor returns a new query executor

func (*ArangoDbQueryExecutor) Execute

func (q *ArangoDbQueryExecutor) Execute(queryText string, bindVars map[string]interface{}) ([]map[string]interface{}, error)

Execute runs the specified query

type MockQueryExecutor

type MockQueryExecutor struct {
	QueryExecutor
}

MockQueryExecutor provides a mock query executor that can be used for testing

func (*MockQueryExecutor) Execute

func (qe *MockQueryExecutor) Execute(_ string, _ map[string]interface{}) ([]map[string]interface{}, error)

Execute returns static data that can be used for testing

type QueryExecutor

type QueryExecutor interface {
	Execute(queryText string, bindVars map[string]interface{}) ([]map[string]interface{}, error)
}

QueryExecutor is an abstraction to simplify mocking queries for testing

Jump to

Keyboard shortcuts

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