gql

package
v0.0.0-...-b36981d Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

README

  1. initial graphQL
go run github.com/99designs/gqlgen init

cd pkg/frontend/delivery/gql

  1. re-generate
go run github.com/99designs/gqlgen --verbose

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = domain.New("NOT_FOUND", "resource was not found")
)

Functions

func CentralizedError

func CentralizedError() handler.Option

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func NewHTTPServer

func NewHTTPServer(eventClient eventProto.EventServiceClient, walletClient walletProto.WalletServiceClient, temporalClient temporalClient.Client) *napnap.NapNap

func RecoverError

func RecoverError() handler.Option

Types

type ComplexityRoot

type ComplexityRoot struct {
	Event struct {
		CreatedAt       func(childComplexity int) int
		Description     func(childComplexity int) int
		ID              func(childComplexity int) int
		PublishedStatus func(childComplexity int) int
		Title           func(childComplexity int) int
		UpdatedAt       func(childComplexity int) int
	}

	Mutation struct {
		PublishEvent func(childComplexity int, input PublishEventInput) int
	}

	Query struct {
		GetEvent  func(childComplexity int, eventID int64) int
		GetEvents func(childComplexity int, input GetEventOptionsInput) int
		GetWallet func(childComplexity int) int
	}

	Wallet struct {
		Amount    func(childComplexity int) int
		ID        func(childComplexity int) int
		UpdatedAt func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type Event

type Event struct {
	ID              int64           `json:"id"`
	Title           string          `json:"title"`
	Description     string          `json:"description"`
	PublishedStatus PublishedStatus `json:"publishedStatus"`
	CreatedAt       time.Time       `json:"createdAt"`
	UpdatedAt       time.Time       `json:"updatedAt"`
}

type GetEventOptionsInput

type GetEventOptionsInput struct {
	ID    int64  `json:"id"`
	Title string `json:"title"`
}

type MutationResolver

type MutationResolver interface {
	PublishEvent(ctx context.Context, input PublishEventInput) (*bool, error)
}

type PublishEventInput

type PublishEventInput struct {
	EventID int64 `json:"eventID"`
}

type PublishedStatus

type PublishedStatus string
const (
	PublishedStatusDraft     PublishedStatus = "DRAFT"
	PublishedStatusPublished PublishedStatus = "PUBLISHED"
)

func (PublishedStatus) IsValid

func (e PublishedStatus) IsValid() bool

func (PublishedStatus) MarshalGQL

func (e PublishedStatus) MarshalGQL(w io.Writer)

func (PublishedStatus) String

func (e PublishedStatus) String() string

func (*PublishedStatus) UnmarshalGQL

func (e *PublishedStatus) UnmarshalGQL(v interface{}) error

type QueryResolver

type QueryResolver interface {
	GetEvents(ctx context.Context, input GetEventOptionsInput) ([]*Event, error)
	GetEvent(ctx context.Context, eventID int64) (*Event, error)
	GetWallet(ctx context.Context) (*Wallet, error)
}

type Resolver

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

Resolver will be used to handles all business logic

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

Mutation returns MutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
}

type Wallet

type Wallet struct {
	ID        int64     `json:"id"`
	Amount    int64     `json:"amount"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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