resolvers

package
v0.0.0-...-e40ed67 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUserID

func GetUserID(ctx context.Context) handlers.StructPublicID

func NewSchema

func NewSchema(db *sqlx.DB) *graphql.Schema

NewSchema creates a new schema based on schema type and query struct

Types

type GraphQLBody

type GraphQLBody struct {
	Query         string `json:"query"`
	OperationName string `json:"operationName"`
	Variables     string `json:"variables"`
}

GraphQLBody is a struct for storing graphql request data

type ItemInReceiptResolver

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

ItemInReceiptResolver is a struct for resolver itemInReceipt

func (*ItemInReceiptResolver) Amount

func (r *ItemInReceiptResolver) Amount() float64

Amount gets the amount field from itemInReceipt

func (*ItemInReceiptResolver) ID

func (r *ItemInReceiptResolver) ID() string

ID gets the id field from itemInReceipt

func (*ItemInReceiptResolver) ItemID

func (r *ItemInReceiptResolver) ItemID() string

ItemID gets the itemId field from itemInReceipt

func (*ItemInReceiptResolver) Name

func (r *ItemInReceiptResolver) Name() string

Name gets the name field from itemInReceipt

func (*ItemInReceiptResolver) Price

func (r *ItemInReceiptResolver) Price() float64

Price gets the price field from itemInReceipt

func (*ItemInReceiptResolver) Unit

func (r *ItemInReceiptResolver) Unit() string

Unit gets the unit field from itemInReceipt

type ItemInReceiptResolverArgs

type ItemInReceiptResolverArgs struct {
	ReceiptID *string
}

ItemInReceiptResolverArgs is a struct for itemInReceipt resolver arguments

type LocationResolver

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

LocationResolver is a struct for resolved location

func (*LocationResolver) Address

func (r *LocationResolver) Address() string

Address gets the address field from the location

func (*LocationResolver) CreatedAt

func (r *LocationResolver) CreatedAt() graphql.Time

CreatedAt get the createdAt field from the location

func (*LocationResolver) ID

func (r *LocationResolver) ID() string

ID get the id field from location

func (*LocationResolver) Name

func (r *LocationResolver) Name() string

Name gets the name field from the location

func (*LocationResolver) UpdatedAt

func (r *LocationResolver) UpdatedAt() graphql.Time

UpdatedAt gets the updatedAt field from the location

type LocationResolverArgs

type LocationResolverArgs struct {
	Name *string
}

LocationResolverArgs is a struct for location resolver arguments

type Options

type Options struct {
	DB *sqlx.DB
}

Options stores options for GraphQL resolver

func (Options) GraphQLHandler

func (o Options) GraphQLHandler() gin.HandlerFunc

GraphQLHandler handles grpahql requests

type ReceiptResolver

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

ReceiptResolver is a struct for resolved receipt

func (*ReceiptResolver) CreatedAt

func (r *ReceiptResolver) CreatedAt() graphql.Time

CreatedAt gets the createdAt field from receipt

func (*ReceiptResolver) CreatedBy

func (r *ReceiptResolver) CreatedBy() string

CreatedBy get the createdBy field from receipt

func (*ReceiptResolver) ID

func (r *ReceiptResolver) ID() string

ID gets the id field from receipt

func (*ReceiptResolver) ItemsInReceipt

func (r *ReceiptResolver) ItemsInReceipt() *[]*ItemInReceiptResolver

ItemsInReceipt gets the items from a specific receipt for a receipt field

func (*ReceiptResolver) Location

func (r *ReceiptResolver) Location() *LocationResolver

Location get the location field from receipt

func (*ReceiptResolver) TotalPrice

func (r *ReceiptResolver) TotalPrice() float64

TotalPrice gets the totalPrice field from receipt

func (*ReceiptResolver) UpdatedAt

func (r *ReceiptResolver) UpdatedAt() graphql.Time

UpdatedAt gets the updatedAt field from receipt

type ReceiptResolverArgs

type ReceiptResolverArgs struct {
	LocationID *string
}

ReceiptResolverArgs is a struct for receipt resolver arguments

type ReceiptWithDataAndItems

type ReceiptWithDataAndItems struct {
	handlers.ReceiptWithData
	// contains filtered or unexported fields
}

ReceiptWithDataAndItems is a struct for storing both receipt with its data and items from that receipt. This struct is used only in receipt resolver.

type Resolver

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

Resolver struct for storing required data

func (*Resolver) ItemsInReceipt

func (r *Resolver) ItemsInReceipt(ctx context.Context, args ItemInReceiptResolverArgs) (*[]*ItemInReceiptResolver, error)

ItemsInReceipt is a itemInReceipt resolver. If receiptId arguemnt is specified, it gets items from a specified receipt, otherwise it throws an error.

func (*Resolver) Locations

func (r *Resolver) Locations(ctx context.Context, args LocationResolverArgs) (*[]*LocationResolver, error)

Locations is a locations resolver. If name argument is specified, it searches for locations by name

func (*Resolver) Receipts

func (r *Resolver) Receipts(ctx context.Context, args ReceiptResolverArgs) (*[]*ReceiptResolver, error)

Receipts is a receipts resolver. If locationId argument is specified it gets receipts from a specified location

Jump to

Keyboard shortcuts

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