helper

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CarSchema = schema.Schema{
	Objects: &models.Schema{
		Classes: []*models.Class{
			{
				Class: "Manufacturer",
				Properties: []*models.Property{
					{
						Name:         "name",
						DataType:     schema.DataTypeText.PropString(),
						Tokenization: models.PropertyTokenizationWhitespace,
					},
				},
			},
			{
				Class: "Car",
				Properties: []*models.Property{
					{
						Name:     "horsepower",
						DataType: []string{"int"},
					},
					{
						Name:     "weight",
						DataType: []string{"number"},
					},
					{
						Name:         "modelName",
						DataType:     schema.DataTypeText.PropString(),
						Tokenization: models.PropertyTokenizationWhitespace,
					},
					{
						Name:     "madeBy",
						DataType: []string{"Manufacturer"},
					},
					{
						Name:     "startOfProduction",
						DataType: []string{"date"},
					},
					{
						Name:     "stillInProduction",
						DataType: []string{"boolean"},
					},
				},
			},
		},
	},
}

CarSchema contains a car which has every primitive field and a ref field there is

Functions

func CreateSimpleSchema

func CreateSimpleSchema(vectorizer string) schema.Schema

func EmptyList

func EmptyList() interface{}

func EmptyListThunk

func EmptyListThunk() func() interface{}

func IdentityThunk

func IdentityThunk(x interface{}) func() interface{}

func NilThunk

func NilThunk() func() interface{}

func SingletonThunk

func SingletonThunk(x interface{}) func() interface{}

Types

type GraphQLResult

type GraphQLResult struct {
	Result interface{}
}

func (GraphQLResult) Get

func (g GraphQLResult) Get(paths ...string) *GraphQLResult

Drill down in the result

type MockResolver

type MockResolver struct {
	mock.Mock
	Schema        *schema.Schema
	RootField     *graphql.Field
	RootFieldName string
	RootObject    map[string]interface{}
}

func (*MockResolver) AssertErrors

func (mr *MockResolver) AssertErrors(t *testing.T, query string, errors []gqlerrors.FormattedError)

func (*MockResolver) AssertFailToResolve

func (mr *MockResolver) AssertFailToResolve(t *testing.T, query string, errors ...string)

func (*MockResolver) AssertJSONResponse

func (mr *MockResolver) AssertJSONResponse(t *testing.T, query string, expectedResponseString string)

func (*MockResolver) AssertResolve

func (mr *MockResolver) AssertResolve(t *testing.T, query string) *GraphQLResult

func (*MockResolver) Resolve

func (mr *MockResolver) Resolve(query string) *graphql.Result

Jump to

Keyboard shortcuts

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