graphql/

directory
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT

README

GraphQL Interface Layer

This directory contains the GraphQL interface layer implementation following Clean Architecture principles.

Structure

  • generated/ - Auto-generated GraphQL server code by gqlgen (DO NOT EDIT)
  • model/ - Auto-generated GraphQL model types (DO NOT EDIT)
  • resolver/ - GraphQL resolver implementations (manually maintained)

Generated Files

The following files are automatically generated by gqlgen and should not be edited manually:

  • generated/generated.go - Core GraphQL execution engine
  • model/models_gen.go - GraphQL type definitions as Go structs

Resolver Implementation

The resolver layer follows Clean Architecture by:

  1. Dependency Injection: The main Resolver struct holds dependencies (logger, services)
  2. Thin Resolvers: Resolvers delegate business logic to application services
  3. Error Handling: Proper error mapping between domain/application errors and GraphQL errors
  4. Logging: Structured logging for all GraphQL operations
Current Status
  • ✅ Basic resolver structure created
  • ✅ Generated code compiles successfully
  • ✅ Clean architecture patterns established
  • ⏳ Application service integration (pending task 5)
  • ⏳ Domain layer integration (pending task 4)
TODO
  • Implement Time scalar with proper marshaling/unmarshaling
  • Add application service dependencies when available
  • Implement proper error mapping
  • Add input validation
  • Add context propagation for request tracing

Usage

To regenerate GraphQL code after schema changes:

go run github.com/99designs/gqlgen generate

Testing

Run resolver tests:

go test ./internal/interfaces/graphql/resolver/

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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