graphql

package
v0.0.0-...-d4a5310 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CartGraphQL = graphql.NewObject(
	graphql.ObjectConfig{
		Name: "Cart",
		Fields: graphql.Fields{
			"id": &graphql.Field{
				Type: graphql.Int,
			},
			"items_id": &graphql.Field{
				Type: graphql.Int,
			},
			"quantity": &graphql.Field{
				Type: graphql.Int,
			},
			"updated_at": &graphql.Field{
				Type: graphql.DateTime,
			},
			"created_at": &graphql.Field{
				Type: graphql.DateTime,
			},
		},
	},
)

CartGraphQL holds order information with graphql object

View Source
var OrderGraphQL = graphql.NewObject(
	graphql.ObjectConfig{
		Name: "Order",
		Fields: graphql.Fields{
			"id": &graphql.Field{
				Type: graphql.Int,
			},
			"total_price": &graphql.Field{
				Type: graphql.Float,
			},
			"updated_at": &graphql.Field{
				Type: graphql.DateTime,
			},
			"created_at": &graphql.Field{
				Type: graphql.DateTime,
			},
		},
	},
)

OrderGraphQL holds order information with graphql object

Functions

This section is empty.

Types

type Resolver

type Resolver interface {
	Placeholder(params graphql.ResolveParams) (interface{}, error)
	AddCart(params graphql.ResolveParams) (interface{}, error)
	ConfirmOrder(params graphql.ResolveParams) (interface{}, error)
}

func NewResolver

func NewResolver(orderService order.Usecase) Resolver

type Schema

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

Schema is struct which has method for Query and Mutation. Please init this struct using constructor function.

func NewSchema

func NewSchema(orderResolver Resolver) Schema

NewSchema initializes Schema struct which takes resolver as the argument.

func (Schema) Mutation

func (s Schema) Mutation() *graphql.Object

Mutation initializes config schema mutation for graphql server.

func (Schema) Query

func (s Schema) Query() *graphql.Object

Query initializes config schema query for graphql server.

Jump to

Keyboard shortcuts

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