All Projects → jensneuse → Graphql Go Tools

jensneuse / Graphql Go Tools

Licence: mit
Tools to write high performance GraphQL applications using Go/Golang.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects
introspection
24 projects

Projects that are alternatives of or similar to Graphql Go Tools

Charly Vm
Fibers, Closures, C-Module System | NaN-boxing, bytecode-VM written in C++
Stars: ✭ 66 (-31.25%)
Mutual labels:  ast, lexer, parser
Exprtk
C++ Mathematical Expression Parsing And Evaluation Library
Stars: ✭ 301 (+213.54%)
Mutual labels:  ast, lexer, parser
Escaya
An blazing fast 100% spec compliant, incremental javascript parser written in Typescript
Stars: ✭ 217 (+126.04%)
Mutual labels:  ast, parser, parsing
Snapdragon
snapdragon is an extremely pluggable, powerful and easy-to-use parser-renderer factory.
Stars: ✭ 180 (+87.5%)
Mutual labels:  ast, lexer, parser
Meriyah
A 100% compliant, self-hosted javascript parser - https://meriyah.github.io/meriyah
Stars: ✭ 690 (+618.75%)
Mutual labels:  ast, parser, parsing
Cub
The Cub Programming Language
Stars: ✭ 198 (+106.25%)
Mutual labels:  ast, lexer, parser
Parser
A lexer and parser for GraphQL in .NET
Stars: ✭ 163 (+69.79%)
Mutual labels:  graphql, ast, lexer
Whispers
Identify hardcoded secrets and dangerous behaviours
Stars: ✭ 66 (-31.25%)
Mutual labels:  linter, parser, parsing
Tiny Compiler
A tiny compiler for a language featuring LL(2) with Lexer, Parser, ASM-like codegen and VM. Complex enough to give you a flavour of how the "real" thing works whilst not being a mere toy example
Stars: ✭ 425 (+342.71%)
Mutual labels:  ast, lexer, parser
Php Parser
🌿 NodeJS PHP Parser - extract AST or tokens (PHP5 and PHP7)
Stars: ✭ 400 (+316.67%)
Mutual labels:  ast, lexer, parser
Participle
A parser library for Go
Stars: ✭ 2,302 (+2297.92%)
Mutual labels:  ast, lexer, parser
Libdparse
Library for lexing and parsing D source code
Stars: ✭ 91 (-5.21%)
Mutual labels:  ast, parser, parsing
Lioness
The Lioness Programming Language
Stars: ✭ 155 (+61.46%)
Mutual labels:  ast, lexer, parser
Csstree
A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations
Stars: ✭ 1,121 (+1067.71%)
Mutual labels:  ast, lexer, parser
Verible
Verible is a suite of SystemVerilog developer tools, including a parser, style-linter, and formatter.
Stars: ✭ 384 (+300%)
Mutual labels:  linter, lexer, parser
Esprima
ECMAScript parsing infrastructure for multipurpose analysis
Stars: ✭ 6,391 (+6557.29%)
Mutual labels:  ast, parser, parsing
Logos
Create ridiculously fast Lexers
Stars: ✭ 1,001 (+942.71%)
Mutual labels:  lexer, parser, parsing
Astexplorer.app
https://astexplorer.net with ES Modules support and Hot Reloading
Stars: ✭ 65 (-32.29%)
Mutual labels:  ast, parser
Formula Parser
Parsing and evaluating mathematical formulas given as strings.
Stars: ✭ 62 (-35.42%)
Mutual labels:  parser, parsing
Parser Javascript
Browser sniffing gone too far — A useragent parser library for JavaScript
Stars: ✭ 66 (-31.25%)
Mutual labels:  parser, parsing

GoDoc CI

graphql-go-tools

Looking for a ready to use GraphQL Server/Gateway?

Have a look at: https://github.com/jensneuse/graphql-gateway

This repository implements low level building blocks to write graphql services in Go.

With this library you could build tools like:

  • proxies
  • caches
  • server/client implementations
  • a WAF
  • be creative! =)

Currently implemented:

  • GraphQL AST as of https://graphql.github.io/graphql-spec/June2018
  • Token lexing
  • AST parsing: parse bytes/string into AST
  • AST printing: print an AST to an io.Writer
    • supports indentation
  • AST validation:
    • all rules from the spec implemented
  • AST visitor:
    • simple visitor: fastest implementation, without field type definition information
    • visitor: a bit more overhead but has field type definitions and other quirks
  • AST normalization
    • remove unnecessary include/skip directives
    • field deduplication
    • field selection merging
    • fragment definition removal
    • fragment spread inlining
    • inline fragment merging
    • remove self aliasing
    • type extension merging
    • remove type extensions
  • Introspection: transforms a graphql schema into a resolvable Data Source
  • AST execution
    • query planning: turns a Query AST into a cacheable execution plan
      • supported DataSources:
        • GraphQL (multiple GraphQL services can be combined)
        • static (static embedded data)
        • HTTP JSON
        • HTTP JSON Streaming (uses polling to create a stream)
        • MQTT
        • Nats
        • Webassembly (resolve a Request using WASI compliant modules)
    • query execution: takes a context object and executes an execution plan
  • Middleware:
    • Operation Complexity: Calculates the complexity of an operation based on the GitHub algorithm
  • OperationReport: Makes it easy to collect errors during all phases of a request and enables easy error printing according to the GraphQL spec
  • Playground: Easy hosting of GraphQL Playground (no external dependencies, simple middleware)
  • Import Statements: combine multiple GraphQL files into one single schema using #import statements

Go version Info

This repos uses go modules so make sure to use the latest version of Go.

Docs

https://godoc.org/github.com/jensneuse/graphql-go-tools

Usage

Look into the docs. Other than that, tests definitely help understanding this library.

Testing

make test

Linting

make lint

Performance

Most hot path operations have 0 allocations. You should expect this library to exceed all alternatives in terms of performance. I've compared my implementation vs. others but why trust my numbers? Feel free to add comparisons via PR.

Benchmarks

Parse Kitchen Sink (1020 chars, example from Facebook):

pkg: github.com/jensneuse/graphql-go-tools/pkg/astparser
BenchmarkKitchenSink 	  189426	      5652 ns/op	       0 B/op	       0 allocs/op
BenchmarkKitchenSink 	  198253	      5526 ns/op	       0 B/op	       0 allocs/op
BenchmarkKitchenSink 	  199924	      5553 ns/op	       0 B/op	       0 allocs/op
BenchmarkKitchenSink 	  212695	      5804 ns/op	       0 B/op	       0 allocs/op

CPU and Memory consumption for lexing, parsing as well as most other operations is neglectable, even for larger queries.

Contributors

  • Jens Neuse (Project Lead & Active Maintainer)
  • Mantas Vidutis
    • Contributions to the http proxy & the Context Middleware
  • Jonas Bergner
    • Contributions to the initial version of the parser, contributions to the tests
    • Implemented Type Extension merging #108
  • Patric Vormstein
    • Fixed lexer on windows #92
    • Author of the graphql package to simplify the usage of the library
    • Refactored the http package to simplify usage with http servers
    • Author of the starwars package to enhance testing
  • Sergey Petrunin
    • Helped cleaning up the API of the pipeline package #166
    • Refactored the ast package into multiple files
    • Author of the introspection converter (introspection JSON -> AST)
    • Fixed various bugs in the parser & visitor & printer
    • Refactored and enhanced the astimport package

Contributions

Feel free to file an issue in case of bugs. We're open to your ideas to enhance the repository.

You are open to contribute via PR's. Please open an issue to discuss your idea before implementing it so we can have a discussion. Make sure to comply with the linting rules. You must not add untested code.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].