helper

package
v0.0.0-...-8832f83 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

_       _

*__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. All rights reserved. * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md * DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt) * CONTACT: hello@creativesoftwarefdn.org

_       _

*__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. All rights reserved. * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md * DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt) * CONTACT: hello@creativesoftwarefdn.org

_       _

*__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. All rights reserved. * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md * DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt) * CONTACT: hello@creativesoftwarefdn.org

Index

Constants

This section is empty.

Variables

View Source
var CarSchema = schema.Schema{
	Things: &models.SemanticSchema{
		Classes: []*models.SemanticSchemaClass{
			&models.SemanticSchemaClass{
				Class: "Manufacturer",
				Properties: []*models.SemanticSchemaClassProperty{
					&models.SemanticSchemaClassProperty{
						Name:       "name",
						AtDataType: []string{"string"},
					},
				},
			},
			&models.SemanticSchemaClass{
				Class: "Car",
				Properties: []*models.SemanticSchemaClassProperty{
					&models.SemanticSchemaClassProperty{
						Name:       "horsepower",
						AtDataType: []string{"int"},
					},
					&models.SemanticSchemaClassProperty{
						Name:       "weight",
						AtDataType: []string{"number"},
					},
					&models.SemanticSchemaClassProperty{
						Name:       "modelName",
						AtDataType: []string{"string"},
					},
					&models.SemanticSchemaClassProperty{
						Name:       "madeBy",
						AtDataType: []string{"Manufacturer"},
					},
					&models.SemanticSchemaClassProperty{
						Name:       "startOfProduction",
						AtDataType: []string{"date"},
					},
					&models.SemanticSchemaClassProperty{
						Name:       "stillInProduction",
						AtDataType: []string{"boolean"},
					},
				},
			},
		},
	},
	Actions: &models.SemanticSchema{
		Classes: []*models.SemanticSchemaClass{},
	},
}

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

View Source
var SimpleSchema = schema.Schema{
	Things: &models.SemanticSchema{
		Classes: []*models.SemanticSchemaClass{
			&models.SemanticSchemaClass{
				Class: "SomeThing",
				Properties: []*models.SemanticSchemaClassProperty{
					&models.SemanticSchemaClassProperty{
						Name:       "NetworkRefField",
						AtDataType: []string{"OtherInstance/SomeRemoteClass"},
					},
				},
			},
		},
	},
	Actions: &models.SemanticSchema{
		Classes: []*models.SemanticSchemaClass{
			&models.SemanticSchemaClass{
				Class: "SomeAction",
				Properties: []*models.SemanticSchemaClassProperty{
					&models.SemanticSchemaClassProperty{
						Name:       "intField",
						AtDataType: []string{"int"},
					},
					&models.SemanticSchemaClassProperty{
						Name:       "location",
						AtDataType: []string{"geoCoordinates"},
					},
					&models.SemanticSchemaClassProperty{
						Name:       "hasAction",
						AtDataType: []string{"SomeAction"},
					},
					&models.SemanticSchemaClassProperty{
						Name:        "hasActions",
						AtDataType:  []string{"SomeAction"},
						Cardinality: &many,
					},
				},
			},
		},
	},
}

Functions

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)

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