generator

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Where all the magic happens

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructObjectFromPArgs

func ConstructObjectFromPArgs(modelType reflect.Type, p *graphql.ResolveParams) (*interface{}, []reflect.StructField)

Reads out the GraphQL arguments and writes them into a new object. Consider this as a kind of deserialization.

Types

type GraphQLSchemaGenerator added in v0.9.16

type GraphQLSchemaGenerator struct {
	// contains filtered or unexported fields
}

func GenerateGraphQLSchema

func GenerateGraphQLSchema(
	db *database.Database, excludeModels []interface{},
	customQueryFields graphql.Fields, customMutationFields graphql.Fields,
	models ...interface{}) (graphql.Schema, *GraphQLSchemaGenerator, error)

func (*GraphQLSchemaGenerator) AutoResolve added in v0.9.16

func (gen *GraphQLSchemaGenerator) AutoResolve(model interface{}, returnList bool) graphql.FieldResolveFn

func (*GraphQLSchemaGenerator) AutoResolveCreateOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) AutoResolveCreateOne(model interface{}) graphql.FieldResolveFn

func (*GraphQLSchemaGenerator) AutoResolveDeleteOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) AutoResolveDeleteOne(model interface{}) graphql.FieldResolveFn

func (*GraphQLSchemaGenerator) AutoResolveQueryList added in v0.9.16

func (gen *GraphQLSchemaGenerator) AutoResolveQueryList(model interface{}) graphql.FieldResolveFn

func (*GraphQLSchemaGenerator) AutoResolveQueryOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) AutoResolveQueryOne(model interface{}) graphql.FieldResolveFn

func (*GraphQLSchemaGenerator) AutoResolveUpdateOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) AutoResolveUpdateOne(model interface{}) graphql.FieldResolveFn

func (*GraphQLSchemaGenerator) CreateOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) CreateOne(model interface{}) *graphql.Field

func (*GraphQLSchemaGenerator) Database added in v0.9.16

func (gen *GraphQLSchemaGenerator) Database() *database.Database

func (*GraphQLSchemaGenerator) DeleteOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) DeleteOne(model interface{}) *graphql.Field

func (*GraphQLSchemaGenerator) GenerateMutationFields added in v0.9.16

func (gen *GraphQLSchemaGenerator) GenerateMutationFields() *graphql.Fields

func (*GraphQLSchemaGenerator) GenerateMutationObject added in v0.9.16

func (gen *GraphQLSchemaGenerator) GenerateMutationObject() *graphql.Object

func (*GraphQLSchemaGenerator) GenerateQueryFields added in v0.9.16

func (gen *GraphQLSchemaGenerator) GenerateQueryFields() *graphql.Fields

func (*GraphQLSchemaGenerator) GenerateQueryObject added in v0.9.16

func (gen *GraphQLSchemaGenerator) GenerateQueryObject() *graphql.Object

func (*GraphQLSchemaGenerator) GetGraphQLObjType added in v0.9.16

func (gen *GraphQLSchemaGenerator) GetGraphQLObjType(model interface{}, shouldSkipRelations bool) *graphql.Object

Generates a GraphQL object based on a model. Uses a cache to speed up subsequent calls and make sure there are no duplicates. The cache is very important because otherwise GraphQL will spit out weird errors as it expects every type to only exist once and gets easily confused.

func (*GraphQLSchemaGenerator) InputFieldConfigArgs added in v0.9.16

func (gen *GraphQLSchemaGenerator) InputFieldConfigArgs(model interface{}, shouldSkipRelations bool, idBehavior IDBehavior) *graphql.FieldConfigArgument

func (*GraphQLSchemaGenerator) QueryList added in v0.9.16

func (gen *GraphQLSchemaGenerator) QueryList(model interface{}) *graphql.Field

func (*GraphQLSchemaGenerator) QueryOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) QueryOne(model interface{}) *graphql.Field

func (*GraphQLSchemaGenerator) UpdateOne added in v0.9.16

func (gen *GraphQLSchemaGenerator) UpdateOne(model interface{}) *graphql.Field

type IDBehavior added in v0.9.0

type IDBehavior int
const (
	// IDBehaviorSkip skips the Id field in input arguments
	IDBehaviorSkip IDBehavior = iota
	// IDBehaviorInclusive includes the Id field in input arguments among other arguments
	IDBehaviorInclusive
	// IDBehaviorExclusive exclusively includes the Id field in input arguments, skipping all others
	IDBehaviorExclusive
)

Jump to

Keyboard shortcuts

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