ggql icon indicating copy to clipboard operation
ggql copied to clipboard

GraphQL implementation for golang.

GGql

A GraphQL implementation for a GraphQL API that is easy to use and understand while still providing good performance.

License Build Status ReportCard go.dev reference Coverage FOSSA Status

Features

  • Simple binding of GraphQL schema elements to golang types and functions.
  • Multiple resolver options including dynamic resolvers.
  • High performance
  • No external dependencies.

News

  • The first release is out! Benchmarks look good, documentation is complete, and examples available.

Using

The examples provide the best explanation for how to use the package.

  • Examples of each resolver approach.
    • Reflection Resolver Example
    • Interface Resolver Example
    • Root Resolver Example
    • WebSocket Subscription Example

Installation

go get github.com/uhn/ggql

To build and install the ggqlgen application:

go install ./...

Releases

See CHANGELOG.md

Benchmarks

Benchmarks are against graphql-go which is currently the most common golang GraphQL package. The ggql-i package is using the interface resolvers (Resolver and ListResolver) while the ggql framework is using reflection. For a more comprehensive comparison go to graphql-benchmarks.

Parameters

  • Last updated: 2020-06-10
  • OS: Linux (version: 5.7.1-050701-generic, arch: x86_64)
  • CPU Cores: 12
  • Connections: 1000
  • Duration: 20 seconds
  • Units:
    • Rates are in requests per second.
    • Latency is in milliseconds.
    • Verbosity is the number of non-blank lines of code excluding comments.

Rate

Language Framework(version) Rate Median Latency Average Latency 90th % 99th % Std Dev Verbosity
go (1.14) ggql-i (1.0.0) 205058 0.062 0.060 0.068 0.088 0.02 253
go (1.14) ggql (1.0.0) 201986 0.062 0.057 0.066 0.073 0.02 176
go (1.14) graphql-go (0.7.9) 32843 0.078 0.075 0.086 0.102 0.03 378

Latency

Language Framework(version) Rate Median Latency Average Latency 90th % 99th % Std Dev Verbosity
go (1.14) ggql-i (1.0.0) 205058 0.062 0.060 0.068 0.088 0.02 253
go (1.14) ggql (1.0.0) 201986 0.062 0.057 0.066 0.073 0.02 176
go (1.14) graphql-go (0.7.9) 32843 0.078 0.075 0.086 0.102 0.03 378

Verbosity

Language Framework(version) Rate Median Latency Average Latency 90th % 99th % Std Dev Verbosity
go (1.14) ggql (1.0.0) 201986 0.062 0.057 0.066 0.073 0.02 176
go (1.14) ggql-i (1.0.0) 205058 0.062 0.060 0.068 0.088 0.02 253
go (1.14) graphql-go (0.7.9) 32843 0.078 0.075 0.086 0.102 0.03 378

License

Unless otherwise noted, the GGQL source files are distributed under the Apache Version 2.0 license found in the LICENSE file.

More Information

  • Overview of the package and how to use it.
  • FAQ
  • Go Docs