graphqlcore

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type ComplexityRoot

type ComplexityRoot struct {
	Mutation struct {
		LoginUser     func(childComplexity int, input schemas.LoginUserInput) int
		RefreshTokens func(childComplexity int, input schemas.RefreshTokensInput) int
		RegisterUser  func(childComplexity int, input schemas.RegisterUserInput) int
	}

	Query struct {
		Me    func(childComplexity int, accessToken string) int
		User  func(childComplexity int, id string) int
		Users func(childComplexity int) int
	}

	Tokens struct {
		AccessToken  func(childComplexity int) int
		RefreshToken func(childComplexity int) int
	}

	User struct {
		CreatedAt func(childComplexity int) int
		Email     func(childComplexity int) int
		ID        func(childComplexity int) int
		UpdatedAt func(childComplexity int) int
	}
}

type Config

type Config struct {
	Schema     *ast.Schema
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type MutationResolver

type MutationResolver interface {
	RegisterUser(ctx context.Context, input schemas.RegisterUserInput) (int, error)
	LoginUser(ctx context.Context, input schemas.LoginUserInput) (*entities.TokensDTO, error)
	RefreshTokens(ctx context.Context, input schemas.RefreshTokensInput) (*entities.TokensDTO, error)
}

type QueryResolver

type QueryResolver interface {
	Users(ctx context.Context) ([]*entities.User, error)
	User(ctx context.Context, id string) (*entities.User, error)
	Me(ctx context.Context, accessToken string) (*entities.User, error)
}

type Resolver

type Resolver struct {
	UseCases interfaces.UseCases
	Logger   *slog.Logger
}

Resolver

This file will not be regenerated automatically. It serves as dependency injection for your app, add any dependencies you require here.

https://stackoverflow.com/questions/62348857/unit-testing-graphql-in-golang

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
}

Jump to

Keyboard shortcuts

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