rename in code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 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
|
||||
|
||||
@@ -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.
|
||||
|
||||
**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)
|
||||
|
||||
@@ -277,6 +277,6 @@ This can all be configurable globally -- say you can decide whether to use conte
|
||||
|
||||
### 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.
|
||||
|
||||
@@ -52,7 +52,7 @@ graphqlClient := graphql.NewClient("https://example.com/graphql", http.DefaultCl
|
||||
viewerResp, _ := getViewer(context.Background(), graphqlClient)
|
||||
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/`.
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
# example of genql
|
||||
# example of genqlient
|
||||
|
||||
## Getting a token
|
||||
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
|
||||
```
|
||||
|
||||
## Running genql
|
||||
## Running genqlient
|
||||
|
||||
It's already checked in to github, but to generate `generated.go`:
|
||||
```sh
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type authedTransport struct {
|
||||
@@ -61,4 +61,4 @@ func Main() {
|
||||
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
|
||||
|
||||
import (
|
||||
example "github.com/Khan/genql/example"
|
||||
example "github.com/Khan/genqlient/example"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package example
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type getUserResponse struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestGenerateExample(t *testing.T) {
|
||||
}
|
||||
|
||||
repoRoot := filepath.Dir(filepath.Dir(thisFile))
|
||||
configFilename := filepath.Join(repoRoot, "example/genql.yaml")
|
||||
configFilename := filepath.Join(repoRoot, "example/genqlient.yaml")
|
||||
config, err := ReadAndValidateConfig(configFilename)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package {{.Config.Package}}
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
{{- if .Config.ContextType -}}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"encoding/json"
|
||||
{{end}}
|
||||
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
{{/* TODO: type-assert that your ctx type implements context.Context */}}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type InputObjectQueryResponse struct {
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type InterfaceNoFragmentsQueryResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type ListInputQueryResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithAliasResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithDoubleAliasResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithEnumsResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithSlicesResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithStructsResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type SimpleInputQueryResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type SimpleQueryResponse struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type TypeNameQueryResponse struct {
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type UnionNoFragmentsQueryRandomLeafArticle struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type UsesEnumTwiceQueryMeUser struct {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genql/graphql"
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type unexportedResponse struct {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/Khan/genql
|
||||
module github.com/Khan/genqlient
|
||||
|
||||
go 1.13
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ type Client interface {
|
||||
// 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
|
||||
// is disabled in the genql settings, this will be set to
|
||||
// is disabled in the genqlient settings, this will be set to
|
||||
// context.Background().
|
||||
//
|
||||
// query is the literal string representing the GraphQL query, e.g.
|
||||
|
||||
Reference in New Issue
Block a user