gql

package
v0.0.0-...-952be2d Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var User = graphql.NewObject(
	graphql.ObjectConfig{
		Name: "User",
		Fields: graphql.Fields{
			"id": &graphql.Field{
				Type: graphql.Int,
			},
			"name": &graphql.Field{
				Type: graphql.String,
			},
			"age": &graphql.Field{
				Type: graphql.Int,
			},
			"profession": &graphql.Field{
				Type: graphql.String,
			},
			"friendly": &graphql.Field{
				Type: graphql.Boolean,
			},
		},
	},
)

User describes a graphql object containing a User

Functions

func ExecuteQuery

func ExecuteQuery(query string, schema graphql.Schema) *graphql.Result

ExecuteQuery runs our graphql queries

Types

type Resolver

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

Resolver struct holds a connection to our database

func (*Resolver) UserResolver

func (r *Resolver) UserResolver(p graphql.ResolveParams) (interface{}, error)

UserResolver resolves our user query through a db call to GetUserByName

type Root

type Root struct {
	Query *graphql.Object
}

Root holds a pointer to a graphql object

func NewRoot

func NewRoot(db *postgres.Db) *Root

NewRoot returns base query type. This is where we add all the base queries

Jump to

Keyboard shortcuts

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