• Stars
    star
    248
  • Rank 163,560 (Top 4 %)
  • Language
    Go
  • Created over 8 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A powerful GraphQL server implementation for Golang

GraphQL

A powerful GraphQL server implementation for Golang. Its aim is to be the fastest GraphQL implementation.

$ cat test.go
package main

import (
	"fmt"

	"github.com/playlyfe/go-graphql"
)

func main() {
	schema := `
	## double hashed comments be parsed as descriptions and show up in
	## introspection queries
	interface Pet {
	    name: String
	}
	# this is an internal comment
	type Dog implements Pet {
	    name: String
	    woofs: Boolean
	}
	type Cat implements Pet {
	    name: String
	    meows: Boolean
	}
	type QueryRoot {
	    pets: [Pet]
	}
	`
	resolvers := map[string]interface{}{}
	resolvers["QueryRoot/pets"] = func(params *graphql.ResolveParams) (interface{}, error) {
		return []map[string]interface{}{
			{
				"__typename": "Dog",
				"name":       "Odie",
				"woofs":      true,
			},
			{
				"__typename": "Cat",
				"name":       "Garfield",
				"meows":      false,
			},
		}, nil
	}
	context := map[string]interface{}{}
	variables := map[string]interface{}{}
	executor, err := graphql.NewExecutor(schema, "QueryRoot", "", resolvers)
	executor.ResolveType = func(value interface{}) string {
		if object, ok := value.(map[string]interface{}); ok {
			return object["__typename"].(string)
		}
		return ""
	}
	query := `{
		pets {
			name
			... on Dog {
				woofs
			}
			... on Cat {
				meows
			}
		}
	}`
	result, err := executor.Execute(context, query, variables, "")
	if err != nil {
	    panic(err)
	}
	fmt.Printf("%v", result)
}

Benchmarks

Name                                 Repetitions   
BenchmarkGoGraphQLMaster-4             10000        230846 ns/op       29209 B/op        543 allocs/op
BenchmarkPlaylyfeGraphQLMaster-4       50000         27647 ns/op        3269 B/op         61 allocs/op

More

graphql-js master

wrk -t12 -c400 -d30s --timeout 10s "http://localhost:3002/graphql?query={hello}"
Running 30s test @ http://localhost:3002/graphql?query={hello}
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   219.79ms   80.35ms 613.69ms   78.38%
    Req/Sec   149.99     96.37   494.00     58.29%
  52157 requests in 30.05s, 9.96MB read
Requests/sec:   1735.60
Transfer/sec:    339.33KB

graphql-go master

wrk -t12 -c400 -d30s --timeout 10s "http://localhost:3003/graphql?query={hello}"
Running 30s test @ http://localhost:3003/graphql?query={hello}
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   134.97ms  163.47ms   1.85s    86.12%
    Req/Sec   372.46    236.09     1.58k    70.99%
  133607 requests in 30.05s, 18.35MB read
Requests/sec:   4445.99
Transfer/sec:    625.22KB

playlyfe/go-graphql master

wrk -t12 -c400 -d30s --timeout 10s "http://localhost:3003/graphql?query={hello}"
Running 30s test @ http://localhost:3003/graphql?query={hello}
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    34.89ms   43.72ms 518.00ms   87.58%
    Req/Sec     1.44k     0.90k    6.10k    81.35%
  514095 requests in 30.05s, 70.60MB read
Requests/sec:  17108.13
Transfer/sec:      2.35MB

TODO

Validator

License

Playlyfe GraphQL
http://dev.playlyfe.com/
Copyright(c) 2015-2016, Playlyfe IT Solutions Pvt. Ltd, [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

themis

A blazing fast JSON Schema v4 validator!
HTML
60
star
2

docker-canvas

A docker environment for developing on the Canvas LMS
Shell
20
star
3

poseidon-mongo

A future wrapper around the Node Native MongoDB driver using Poseidon - https://github.com/playlyfe/poseidon
JavaScript
20
star
4

docker-moodle

A docker environment for developing on the Moodle LMS
Dockerfile
12
star
5

playlyfe-js-sdk

Playlyfe Javascript SDK for browser based client side applications.
JavaScript
4
star
6

playlyfe-php-sdk

PHP SDK for the Playlyfe API
PHP
4
star
7

poseidon

Poseidon allows you to wrap existing Node Module APIs in a simple promise layer using Bluebird for easier programming.
JavaScript
4
star
8

playlyfe-node-sdk

The official OAuth 2.0 NodeJS SDK for the Playlyfe REST API
CoffeeScript
3
star
9

playlyfe-csharp-sdk

The official OAuth 2.0 C# SDK for the Playlyfe REST API
C#
3
star
10

aegis

The CSS Library.
CSS
3
star
11

demo-website

A demonstration of a Website using the Playlyfe platform to engage its users
CoffeeScript
3
star
12

playlyfe-express-app

NodeJS express skeleton for playlyfe applications.
JavaScript
3
star
13

seaweedfs-node

A SeaweedFS NodeJS client
CoffeeScript
2
star
14

playlyfe-python-sdk

The official OAuth 2.0 Python SDK for the Playlyfe REST API
Python
2
star
15

playlyfe-go-sdk

This is the official Playlyfe Golang Sdk
Go
2
star
16

odysseus

Parse and build stories out of the Playlyfe Events.
CoffeeScript
2
star
17

playlyfe-ruby-sdk

The official OAuth 2.0 Ruby SDK for the Playlyfe REST API
Ruby
2
star
18

playlyfe-java-sdk

The official OAuth 2.0 Java SDK for the Playlyfe REST API
Java
1
star
19

passport-playlyfe

Playlyfe passport authentication strategy for NodeJS
JavaScript
1
star
20

playlyfe-python-graphql-sdk

The Playlyfe Python GraphQL API V3 SDK
Python
1
star
21

cucumber

A cucumber implementation for golang
Go
1
star
22

playlyfe-crystal-sdk

The Official Playlyfe SDK for Crystal Language supports the OAuth 2 Flows and JWT Flow
Crystal
1
star
23

policy

A Repository of All of Playlyfe's Policies and Guidelines
1
star
24

jet-set-gamify

The Jet-Set-Gamify tutorial series focusses on helping you create a kick-ass Gamified app from scratch using the Playlyfe Platform.
JavaScript
1
star