rename in code
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Design decisions
|
# Design decisions
|
||||||
|
|
||||||
This file contains a log of miscellaneous design decisions in genql.
|
This file contains a log of miscellaneous design decisions in genqlient.
|
||||||
|
|
||||||
## Types
|
## Types
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ Instead, we will likely have to do that configuration in comments, which we alre
|
|||||||
|
|
||||||
Or, we can figure out how to avoid configuration entirely. This seems short-sighted but may be possible if we can solve for optionality another way and decide collapsing is a non-issue.
|
Or, we can figure out how to avoid configuration entirely. This seems short-sighted but may be possible if we can solve for optionality another way and decide collapsing is a non-issue.
|
||||||
|
|
||||||
**Decision:** We'll configure with comments on the field of the form `# @genql(...)`, syntax TBD but similar to a GraphQL directive.
|
**Decision:** We'll configure with comments on the field of the form `# @genqlient(...)`, syntax TBD but similar to a GraphQL directive.
|
||||||
|
|
||||||
### Query function signatures (context/client)
|
### Query function signatures (context/client)
|
||||||
|
|
||||||
@@ -277,6 +277,6 @@ This can all be configurable globally -- say you can decide whether to use conte
|
|||||||
|
|
||||||
### Query extraction (for safelisting)
|
### Query extraction (for safelisting)
|
||||||
|
|
||||||
One thing we want to be able to do is to make it clear exactly what query-document (down to comments and whitespace) we will be sending in the query for the purposes of safelisting and querying based on hash. In the case where you have one query per file, that's easy, just use the whole file. But you may want to share fragments between queries, in which case this is trouble: you either need a way to include fragments from another file (and a defined concatenation order), or you need to have several queries per file, and either have genql extract the right parts (in a defined/reproducible way), or have it send up the full file and the operation name to use (in which case we should still encourage you to not do that unless you're hashing, so that you aren't sending up too much data). We could also allow configuration between the last two options (so if you don't care about hashing/safelisting you can auto-extract).
|
One thing we want to be able to do is to make it clear exactly what query-document (down to comments and whitespace) we will be sending in the query for the purposes of safelisting and querying based on hash. In the case where you have one query per file, that's easy, just use the whole file. But you may want to share fragments between queries, in which case this is trouble: you either need a way to include fragments from another file (and a defined concatenation order), or you need to have several queries per file, and either have genqlient extract the right parts (in a defined/reproducible way), or have it send up the full file and the operation name to use (in which case we should still encourage you to not do that unless you're hashing, so that you aren't sending up too much data). We could also allow configuration between the last two options (so if you don't care about hashing/safelisting you can auto-extract).
|
||||||
|
|
||||||
We can decide this later once we support fragments and safelisting/hashing; it's fine if that's not available at first.
|
We can decide this later once we support fragments and safelisting/hashing; it's fine if that's not available at first.
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ graphqlClient := graphql.NewClient("https://example.com/graphql", http.DefaultCl
|
|||||||
viewerResp, _ := getViewer(context.Background(), graphqlClient)
|
viewerResp, _ := getViewer(context.Background(), graphqlClient)
|
||||||
fmt.Println("you are", viewerResp.Viewer.MyName)
|
fmt.Println("you are", viewerResp.Viewer.MyName)
|
||||||
|
|
||||||
//go:generate go run github.com/Khan/genql
|
//go:generate go run github.com/Khan/genqlient
|
||||||
```
|
```
|
||||||
|
|
||||||
For a complete working example, see `example/`.
|
For a complete working example, see `example/`.
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
# example of genql
|
# example of genqlient
|
||||||
|
|
||||||
## Getting a token
|
## Getting a token
|
||||||
Get a token from [GitHub](https://github.com/settings/tokens/new) (no scopes needed).
|
Get a token from [GitHub](https://github.com/settings/tokens/new) (no scopes needed).
|
||||||
@@ -13,7 +13,7 @@ you are Ben Kraft
|
|||||||
csilvers is Craig Silverstein
|
csilvers is Craig Silverstein
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running genql
|
## Running genqlient
|
||||||
|
|
||||||
It's already checked in to github, but to generate `generated.go`:
|
It's already checked in to github, but to generate `generated.go`:
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type authedTransport struct {
|
type authedTransport struct {
|
||||||
@@ -61,4 +61,4 @@ func Main() {
|
|||||||
fmt.Println(username, "is", userResp.User.TheirName)
|
fmt.Println(username, "is", userResp.User.TheirName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:generate go run github.com/Khan/genql genql.yaml
|
//go:generate go run github.com/Khan/genqlient genqlient.yaml
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
example "github.com/Khan/genql/example"
|
example "github.com/Khan/genqlient/example"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package example
|
package example
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type getUserResponse struct {
|
type getUserResponse struct {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ func TestGenerateExample(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repoRoot := filepath.Dir(filepath.Dir(thisFile))
|
repoRoot := filepath.Dir(filepath.Dir(thisFile))
|
||||||
configFilename := filepath.Join(repoRoot, "example/genql.yaml")
|
configFilename := filepath.Join(repoRoot, "example/genqlient.yaml")
|
||||||
config, err := ReadAndValidateConfig(configFilename)
|
config, err := ReadAndValidateConfig(configFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package {{.Config.Package}}
|
package {{.Config.Package}}
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
{{- if .Config.ContextType -}}
|
{{- if .Config.ContextType -}}
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
{{/* TODO: type-assert that your ctx type implements context.Context */}}
|
{{/* TODO: type-assert that your ctx type implements context.Context */}}
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InputObjectQueryResponse struct {
|
type InputObjectQueryResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InterfaceNoFragmentsQueryResponse struct {
|
type InterfaceNoFragmentsQueryResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ListInputQueryResponse struct {
|
type ListInputQueryResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type QueryWithAliasResponse struct {
|
type QueryWithAliasResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type QueryWithDoubleAliasResponse struct {
|
type QueryWithDoubleAliasResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type QueryWithEnumsResponse struct {
|
type QueryWithEnumsResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type QueryWithSlicesResponse struct {
|
type QueryWithSlicesResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type QueryWithStructsResponse struct {
|
type QueryWithStructsResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SimpleInputQueryResponse struct {
|
type SimpleInputQueryResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SimpleQueryResponse struct {
|
type SimpleQueryResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TypeNameQueryResponse struct {
|
type TypeNameQueryResponse struct {
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UnionNoFragmentsQueryRandomLeafArticle struct {
|
type UnionNoFragmentsQueryRandomLeafArticle struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UsesEnumTwiceQueryMeUser struct {
|
type UsesEnumTwiceQueryMeUser struct {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/graphql"
|
"github.com/Khan/genqlient/graphql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type unexportedResponse struct {
|
type unexportedResponse struct {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module github.com/Khan/genql
|
module github.com/Khan/genqlient
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ type Client interface {
|
|||||||
// MakeRequest must make a request to the client's GraphQL API.
|
// MakeRequest must make a request to the client's GraphQL API.
|
||||||
//
|
//
|
||||||
// ctx is the context that should be used to make this request. If context
|
// ctx is the context that should be used to make this request. If context
|
||||||
// is disabled in the genql settings, this will be set to
|
// is disabled in the genqlient settings, this will be set to
|
||||||
// context.Background().
|
// context.Background().
|
||||||
//
|
//
|
||||||
// query is the literal string representing the GraphQL query, e.g.
|
// query is the literal string representing the GraphQL query, e.g.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// package main is at the root to allow "go run github.com/Khan/genql"
|
// package main is at the root to allow "go run github.com/Khan/genqlient"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Khan/genql/generate"
|
"github.com/Khan/genqlient/generate"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user