Skip to content

Commit

Permalink
YarQL!!
Browse files Browse the repository at this point in the history
  • Loading branch information
mjarkk committed Apr 6, 2022
1 parent 65ccf76 commit 012831b
Show file tree
Hide file tree
Showing 29 changed files with 47 additions and 44 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Graphql library for GoLang
![Banner](https://github.com/mjarkk/yarql/blob/main/banner.png?raw=true)

[![Go Reference](https://pkg.go.dev/badge/github.com/mjarkk/go-graphql.svg)](https://pkg.go.dev/github.com/mjarkk/go-graphql) [![Go Report Card](https://goreportcard.com/badge/github.com/mjarkk/go-graphql)](https://goreportcard.com/report/github.com/mjarkk/go-graphql) [![Coverage Status](https://coveralls.io/repos/github/mjarkk/go-graphql/badge.svg?branch=main)](https://coveralls.io/github/mjarkk/go-graphql?branch=main)
[![Go Reference](https://pkg.go.dev/badge/github.com/mjarkk/yarql.svg)](https://pkg.go.dev/github.com/mjarkk/yarql) [![Go Report Card](https://goreportcard.com/badge/github.com/mjarkk/yarql)](https://goreportcard.com/report/github.com/mjarkk/yarql) [![Coverage Status](https://coveralls.io/repos/github/mjarkk/go-graphql/badge.svg?branch=main)](https://coveralls.io/github/mjarkk/go-graphql?branch=main)

# YarQL, A Graphql library for GoLang

Just a different approach to making graphql servers in Go

Expand All @@ -11,20 +13,21 @@ Just a different approach to making graphql servers in Go
- Build on top of the [graphql spec 2021](https://spec.graphql.org/October2021/)
- No code generators
- [Only 1 dependency](go.mod)
- Easy to implement in many web servers, see the [gin](https://github.com/mjarkk/go-graphql/blob/main/examples/gin/main.go) and [fiber](https://github.com/mjarkk/go-graphql/blob/main/examples/fiber/main.go) examples
- Easy to implement in many web servers, see the [gin](https://github.com/mjarkk/yarql/blob/main/examples/gin/main.go) and [fiber](https://github.com/mjarkk/yarql/blob/main/examples/fiber/main.go) examples
- [File upload support](#file-upload)
- Supports [Apollo tracing](https://github.com/apollographql/apollo-tracing)
- [Fast](#Performance)

## Example

See the [/examples](https://github.com/mjarkk/go-graphql/tree/main/examples) folder for more examples
See the [/examples](https://github.com/mjarkk/yarql/tree/main/examples) folder for more examples

```go
package main

import (
"log"
"github.com/mjarkk/go-graphql"
"github.com/mjarkk/yarql"
)

type Post struct {
Expand Down Expand Up @@ -365,7 +368,7 @@ In your request add a form file with the field name: `form_file_field_name`

## Testing

There is a [pkg.go.dev mjarkk/go-graphql/tester](https://pkg.go.dev/github.com/mjarkk/go-graphql/tester) package available with handy tools for testing the schema
There is a [pkg.go.dev mjarkk/go-graphql/tester](https://pkg.go.dev/github.com/mjarkk/yarql/tester) package available with handy tools for testing the schema

## Performance

Expand Down
2 changes: 1 addition & 1 deletion assert/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"unicode"
"unicode/utf8"

"github.com/mjarkk/go-graphql/assert/difflib"
"github.com/mjarkk/yarql/assert/difflib"
)

// TestingT is an interface wrapper around *testing.T
Expand Down
Binary file added banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bytecode/bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"unicode/utf8"
"unsafe"

"github.com/mjarkk/go-graphql/bytecode/cache"
"github.com/mjarkk/yarql/bytecode/cache"
)

// ParserCtx has all the information needed to parse a query
Expand Down
2 changes: 1 addition & 1 deletion bytecode/bytecode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"
"testing"

a "github.com/mjarkk/go-graphql/assert"
a "github.com/mjarkk/yarql/assert"
)

func parseQuery(query string) ([]byte, []error) {
Expand Down
2 changes: 1 addition & 1 deletion bytecode/cache/bytecode_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cache
import (
"bytes"

"github.com/mjarkk/go-graphql/helpers"
"github.com/mjarkk/yarql/helpers"
)

// BytecodeCache contains the bytecode cache
Expand Down
4 changes: 2 additions & 2 deletions copy_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package graphql
import (
"reflect"

"github.com/mjarkk/go-graphql/bytecode"
"github.com/mjarkk/go-graphql/helpers"
"github.com/mjarkk/yarql/bytecode"
"github.com/mjarkk/yarql/helpers"
"github.com/valyala/fastjson"
)

Expand Down
2 changes: 1 addition & 1 deletion enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"reflect"
"sort"

h "github.com/mjarkk/go-graphql/helpers"
h "github.com/mjarkk/yarql/helpers"
)

type enum struct {
Expand Down
2 changes: 1 addition & 1 deletion enums_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package graphql
import (
"testing"

a "github.com/mjarkk/go-graphql/assert"
a "github.com/mjarkk/yarql/assert"
)

func TestRegisterEnum(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions examples/fiber/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/mjarkk/go-graphql-fiber-example
module github.com/mjarkk/yarql-fiber-example

go 1.16

require (
github.com/gofiber/fiber/v2 v2.11.0
github.com/mjarkk/go-graphql v0.0.0-20210604095247-1a621d53c91c
github.com/mjarkk/yarql v0.0.0-20210604095247-1a621d53c91c
)

replace github.com/mjarkk/go-graphql => ../../
replace github.com/mjarkk/yarql => ../../
2 changes: 1 addition & 1 deletion examples/fiber/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"mime/multipart"

"github.com/gofiber/fiber/v2"
"github.com/mjarkk/go-graphql"
graphql "github.com/mjarkk/yarql"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/gin/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/mjarkk/go-graphql-gin-example
module github.com/mjarkk/yarql-gin-example

go 1.16

Expand All @@ -16,7 +16,7 @@ require (
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect
golang.org/x/text v0.3.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/mjarkk/go-graphql v0.0.0-20210604095247-1a621d53c91c // indirect
github.com/mjarkk/yarql v0.0.0-20210604095247-1a621d53c91c // indirect
)

replace github.com/mjarkk/go-graphql => ../../
replace github.com/mjarkk/yarql => ../../
2 changes: 1 addition & 1 deletion examples/gin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"

"github.com/gin-gonic/gin"
"github.com/mjarkk/go-graphql"
graphql "github.com/mjarkk/yarql"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/relay/backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/mjarkk/go-graphql-relay-example
module github.com/mjarkk/yarql-relay-example

go 1.16

require (
github.com/gofiber/fiber/v2 v2.11.0
github.com/mjarkk/go-graphql v0.0.0-20210604095247-1a621d53c91c
github.com/mjarkk/yarql v0.0.0-20210604095247-1a621d53c91c
)

replace github.com/mjarkk/go-graphql => ../../../
replace github.com/mjarkk/yarql => ../../../
2 changes: 1 addition & 1 deletion examples/relay/backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/mjarkk/go-graphql"
graphql "github.com/mjarkk/yarql"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/relay/backend/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/mjarkk/go-graphql"
graphql "github.com/mjarkk/yarql"
)

// QueryRoot defines the entry point for all graphql queries
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/mjarkk/go-graphql
module github.com/mjarkk/yarql

go 1.16

Expand Down
4 changes: 2 additions & 2 deletions grahql_types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package graphql

import (
h "github.com/mjarkk/go-graphql/helpers"
h "github.com/mjarkk/yarql/helpers"
)

//
Expand Down Expand Up @@ -221,7 +221,7 @@ var (
Kind: typeKindScalar,
Name: h.StrPtr("File"),
Description: h.StrPtr("The File scalar type references to a multipart file, often used to upload files to the server. Expects a string with the form file field name"),
SpecifiedByURL: h.StrPtr("https://github.com/mjarkk/go-graphql#file-upload"),
SpecifiedByURL: h.StrPtr("https://github.com/mjarkk/yarql#file-upload"),
}
scalarTime = qlType{
Kind: typeKindScalar,
Expand Down
2 changes: 1 addition & 1 deletion implement_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"mime/multipart"
"strings"

"github.com/mjarkk/go-graphql/helpers"
"github.com/mjarkk/yarql/helpers"
"github.com/valyala/fastjson"
)

Expand Down
2 changes: 1 addition & 1 deletion implement_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

a "github.com/mjarkk/go-graphql/assert"
a "github.com/mjarkk/yarql/assert"
)

func TestHandleRequestRequestInURL(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion inject_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"sort"

h "github.com/mjarkk/go-graphql/helpers"
h "github.com/mjarkk/yarql/helpers"
)

func (s *Schema) injectQLTypes(ctx *parseCtx) {
Expand Down
2 changes: 1 addition & 1 deletion interfaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

a "github.com/mjarkk/go-graphql/assert"
a "github.com/mjarkk/yarql/assert"
)

type InterfaceSchema struct {
Expand Down
2 changes: 1 addition & 1 deletion parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

a "github.com/mjarkk/go-graphql/assert"
a "github.com/mjarkk/yarql/assert"
)

func TestFormatGoNameToQL(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion readme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"testing"

a "github.com/mjarkk/go-graphql/assert"
a "github.com/mjarkk/yarql/assert"
)

// Making sure the code in the readme actually works :)
Expand Down
4 changes: 2 additions & 2 deletions resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"time"
"unsafe"

"github.com/mjarkk/go-graphql/bytecode"
"github.com/mjarkk/go-graphql/helpers"
"github.com/mjarkk/yarql/bytecode"
"github.com/mjarkk/yarql/helpers"
"github.com/valyala/fastjson"
)

Expand Down
4 changes: 2 additions & 2 deletions resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"testing"
"time"

a "github.com/mjarkk/go-graphql/assert"
"github.com/mjarkk/go-graphql/helpers"
a "github.com/mjarkk/yarql/assert"
"github.com/mjarkk/yarql/helpers"
)

func bytecodeParse(t *testing.T, s *Schema, query string, queries interface{}, methods interface{}, opts ...ResolveOptions) (string, []error) {
Expand Down
2 changes: 1 addition & 1 deletion tester/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"

"github.com/mjarkk/go-graphql"
graphql "github.com/mjarkk/yarql"
)

// Type contains a subset of fields from the graphql __Type type
Expand Down
4 changes: 2 additions & 2 deletions tester/tester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package tester
import (
"testing"

"github.com/mjarkk/go-graphql"
"github.com/mjarkk/go-graphql/assert"
graphql "github.com/mjarkk/yarql"
"github.com/mjarkk/yarql/assert"
)

type TesterQuerySchema struct {
Expand Down
2 changes: 1 addition & 1 deletion type_rename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

a "github.com/mjarkk/go-graphql/assert"
a "github.com/mjarkk/yarql/assert"
)

var _ = TypeRename(TestTypeRenameData{}, "Foo")
Expand Down

0 comments on commit 012831b

Please sign in to comment.