Skip to content

Commit 186c9c2

Browse files
authored
feat(DQL): Rename gql package to dql (#8429)
## Problem GraphQL Spec uses the acronym GQL to reference its language in its packages. Dgraph used this acronym in the past because the language was called "GraphQL+-". But today as the name has been updated and we have native support for GraphQL. This becomes a problem as it confuses package names. ## Solution Rename GQL package to DQL
1 parent 5c77386 commit 186c9c2

File tree

245 files changed

+551
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

245 files changed

+551
-541
lines changed

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ area/bulk-loader:
88
area/live-loader:
99
- dgraph/cmd/live/**/*
1010
area/querylang:
11-
- gql/**/*
11+
- dql/**/*
1212
area/integrations:
1313
- contrib/**/*
1414
- .github/**/*

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
/osx-docker-gopath
66

77
# fuzzing output
8-
gql/gql-fuzz.zip
9-
gql/fuzz-data/crashers
10-
gql/fuzz-data/suppressions
8+
dql/dql-fuzz.zip
9+
dql/fuzz-data/crashers
10+
dql/fuzz-data/suppressions
1111

1212
# goland project folder
1313
.idea

dgraph/cmd/alpha/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import (
3535
"github.com/dgraph-io/dgraph/graphql/admin"
3636

3737
"github.com/dgraph-io/dgo/v210/protos/api"
38+
"github.com/dgraph-io/dgraph/dql"
3839
"github.com/dgraph-io/dgraph/edgraph"
39-
"github.com/dgraph-io/dgraph/gql"
4040
"github.com/dgraph-io/dgraph/graphql/schema"
4141
"github.com/dgraph-io/dgraph/query"
4242
"github.com/dgraph-io/dgraph/x"
@@ -392,7 +392,7 @@ func mutationHandler(w http.ResponseWriter, r *http.Request) {
392392

393393
case "application/rdf":
394394
// Parse N-Quads.
395-
req, err = gql.ParseMutation(string(body))
395+
req, err = dql.ParseMutation(string(body))
396396
if err != nil {
397397
x.SetStatus(w, x.ErrorInvalidRequest, err.Error())
398398
return

dgraph/cmd/alpha/run_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333

3434
"github.com/dgraph-io/dgo/v210"
3535
"github.com/dgraph-io/dgo/v210/protos/api"
36-
"github.com/dgraph-io/dgraph/gql"
36+
"github.com/dgraph-io/dgraph/dql"
3737
"github.com/dgraph-io/dgraph/protos/pb"
3838
"github.com/dgraph-io/dgraph/query"
3939
"github.com/dgraph-io/dgraph/schema"
@@ -66,7 +66,7 @@ func timestamp() uint64 {
6666
}
6767

6868
func processToFastJSON(q string) string {
69-
res, err := gql.Parse(gql.Request{Str: q})
69+
res, err := dql.Parse(dql.Request{Str: q})
7070
if err != nil {
7171
log.Fatal(err)
7272
}
@@ -874,7 +874,7 @@ var q5 = `
874874
`
875875

876876
func TestSchemaValidationError(t *testing.T) {
877-
_, err := gql.Parse(gql.Request{Str: m5})
877+
_, err := dql.Parse(dql.Request{Str: m5})
878878
require.Error(t, err)
879879
output, err := runGraphqlQuery(strings.Replace(q5, "<id>", "0x8", -1))
880880
require.NoError(t, err)
@@ -1687,8 +1687,8 @@ type Token struct {
16871687
sync.RWMutex
16881688
}
16891689

1690-
//// the grootAccessJWT stores the access JWT extracted from the response
1691-
//// of http login
1690+
// // the grootAccessJWT stores the access JWT extracted from the response
1691+
// // of http login
16921692
var token *Token
16931693

16941694
func (t *Token) getAccessJWTToken() string {

dgraph/cmd/bulk/mapper.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
"github.com/dgraph-io/dgo/v210/protos/api"
3333
"github.com/dgraph-io/dgraph/chunker"
34-
"github.com/dgraph-io/dgraph/gql"
34+
"github.com/dgraph-io/dgraph/dql"
3535
"github.com/dgraph-io/dgraph/posting"
3636
"github.com/dgraph-io/dgraph/protos/pb"
3737
"github.com/dgraph-io/dgraph/tok"
@@ -239,7 +239,7 @@ func (m *mapper) run(inputFormat chunker.InputFormat) {
239239
}
240240
}
241241

242-
m.processNQuad(gql.NQuad{NQuad: nq})
242+
m.processNQuad(dql.NQuad{NQuad: nq})
243243
atomic.AddInt64(&m.prog.nquadCount, 1)
244244
}
245245

@@ -285,7 +285,7 @@ func (m *mapper) addMapEntry(key []byte, p *pb.Posting, shard int) {
285285
marshalMapEntry(dst, uid, key, p)
286286
}
287287

288-
func (m *mapper) processNQuad(nq gql.NQuad) {
288+
func (m *mapper) processNQuad(nq dql.NQuad) {
289289
if m.opt.Namespace != math.MaxUint64 {
290290
// Use the specified namespace passed through '--force-namespace' flag.
291291
nq.Namespace = m.opt.Namespace
@@ -359,7 +359,7 @@ func (m *mapper) lookupUid(xid string, ns uint64) uint64 {
359359
// Don't store xids for blank nodes.
360360
return uid
361361
}
362-
nq := gql.NQuad{NQuad: &api.NQuad{
362+
nq := dql.NQuad{NQuad: &api.NQuad{
363363
Subject: xid,
364364
Predicate: "xid",
365365
ObjectValue: &api.Value{
@@ -371,7 +371,7 @@ func (m *mapper) lookupUid(xid string, ns uint64) uint64 {
371371
return uid
372372
}
373373

374-
func (m *mapper) createPostings(nq gql.NQuad,
374+
func (m *mapper) createPostings(nq dql.NQuad,
375375
de *pb.DirectedEdge) (*pb.Posting, *pb.Posting) {
376376

377377
m.schema.validateType(de, nq.ObjectValue == nil)
@@ -407,7 +407,7 @@ func (m *mapper) createPostings(nq gql.NQuad,
407407
return p, rp
408408
}
409409

410-
func (m *mapper) addIndexMapEntries(nq gql.NQuad, de *pb.DirectedEdge) {
410+
func (m *mapper) addIndexMapEntries(nq dql.NQuad, de *pb.DirectedEdge) {
411411
if nq.GetObjectValue() == nil {
412412
return // Cannot index UIDs
413413
}

dgraph/cmd/live/batch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
"github.com/dgraph-io/badger/v3"
3535
"github.com/dgraph-io/dgo/v210"
3636
"github.com/dgraph-io/dgo/v210/protos/api"
37-
"github.com/dgraph-io/dgraph/gql"
37+
"github.com/dgraph-io/dgraph/dql"
3838
"github.com/dgraph-io/dgraph/protos/pb"
3939
"github.com/dgraph-io/dgraph/tok"
4040
"github.com/dgraph-io/dgraph/types"
@@ -191,7 +191,7 @@ func (l *loader) request(req *request) {
191191
}
192192

193193
func getTypeVal(val *api.Value) (types.Val, error) {
194-
p := gql.TypeValFrom(val)
194+
p := dql.TypeValFrom(val)
195195
//Convert value to bytes
196196

197197
if p.Tid == types.GeoID || p.Tid == types.DateTimeID {

gql/bench_test.go renamed to dql/bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gql
17+
package dql
1818

1919
import (
2020
"testing"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

gql/fuzzit.sh renamed to dql/fuzzit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ wget -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzz
1818
chmod a+x fuzzit
1919

2020
## Create a target on fuzzit servers
21-
./fuzzit create target --skip-if-exists --seed ./gql/fuzz-data/corpus.tar.gz parser-fuzz-target
21+
./fuzzit create target --skip-if-exists --seed ./dql/fuzz-data/corpus.tar.gz parser-fuzz-target
2222
## Start a job (${1} = [fuzzing][local-regression]).
2323
./fuzzit create job --type "${1}" dgraph-io-gh/parser-fuzz-target parser-fuzz-target
2424

gql/math.go renamed to dql/math.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gql
17+
package dql
1818

1919
import (
2020
"bytes"

gql/mutation.go renamed to dql/mutation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gql
17+
package dql
1818

1919
import (
2020
"strconv"

gql/parser.go renamed to dql/parser.go

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gql
17+
package dql
1818

1919
import (
2020
"bytes"
@@ -174,7 +174,7 @@ type Arg struct {
174174
IsGraphQLVar bool
175175
}
176176

177-
// Function holds the information about gql functions.
177+
// Function holds the information about dql functions.
178178
type Function struct {
179179
Attr string
180180
Lang string // language of the attribute value
@@ -362,7 +362,7 @@ func substituteVar(f string, res *string, vmap varMap) error {
362362

363363
func substituteVariables(gq *GraphQuery, vmap varMap) error {
364364
for k, v := range gq.Args {
365-
// v won't be empty as its handled in parseGqlVariables.
365+
// v won't be empty as its handled in parseDqlVariables.
366366
val := gq.Args[k]
367367
if err := substituteVar(v, &val, vmap); err != nil {
368368
return err
@@ -539,20 +539,21 @@ func Parse(r Request) (Result, error) {
539539
//
540540
// The needVars parameter is passed in the case of upsert block.
541541
// For example, when parsing the query block inside -
542-
// upsert {
543-
// query {
544-
// me(func: eq(email, "[email protected]"), first: 1) {
545-
// v as uid
546-
// }
547-
// }
548542
//
549-
// mutation {
550-
// set {
551-
// uid(v) <name> "Some One" .
552-
// uid(v) <email> "[email protected]" .
553-
// }
554-
// }
555-
// }
543+
// upsert {
544+
// query {
545+
// me(func: eq(email, "[email protected]"), first: 1) {
546+
// v as uid
547+
// }
548+
// }
549+
//
550+
// mutation {
551+
// set {
552+
// uid(v) <name> "Some One" .
553+
// uid(v) <email> "[email protected]" .
554+
// }
555+
// }
556+
// }
556557
//
557558
// The variable name v needs to be passed through the needVars parameter. Otherwise, an error
558559
// is reported complaining that the variable v is defined but not used in the query block.
@@ -794,7 +795,7 @@ L2:
794795
return nil, item.Errorf("Variables can be defined only in named queries.")
795796
}
796797

797-
if rerr = parseGqlVariables(it, vmap); rerr != nil {
798+
if rerr = parseDqlVariables(it, vmap); rerr != nil {
798799
return nil, rerr
799800
}
800801

@@ -1150,8 +1151,8 @@ func getSchema(it *lex.ItemIterator) (*pb.SchemaRequest, error) {
11501151
return nil, it.Errorf("Invalid schema block.")
11511152
}
11521153

1153-
// parseGqlVariables parses the the graphQL variable declaration.
1154-
func parseGqlVariables(it *lex.ItemIterator, vmap varMap) error {
1154+
// parseDqlVariables parses the the graphQL variable declaration.
1155+
func parseDqlVariables(it *lex.ItemIterator, vmap varMap) error {
11551156
expectArg := true
11561157
if item, ok := it.PeekOne(); ok && item.Typ == itemRightRound {
11571158
return nil
@@ -1557,7 +1558,7 @@ loop:
15571558
}
15581559

15591560
// parseFuncArgs will try to parse the arguments inside an array ([]). If the values
1560-
// are prefixed with $ they are treated as Gql variables, otherwise they are used as scalar values.
1561+
// are prefixed with $ they are treated as Dql variables, otherwise they are used as scalar values.
15611562
// Returns nil on success while appending arguments to the function Args slice. Otherwise
15621563
// returns an error, which can be a parsing or value error.
15631564
func parseFuncArgs(it *lex.ItemIterator, g *Function) error {
@@ -2113,7 +2114,7 @@ func tryParseFacetList(it *lex.ItemIterator) (res facetRes, parseOk bool, err er
21132114

21142115
// parseCascade parses the cascade directive.
21152116
// Two formats:
2116-
// 1. @cascade
2117+
// 1. @cascade
21172118
// 2. @cascade(pred1, pred2, ...)
21182119
func parseCascade(it *lex.ItemIterator, gq *GraphQuery) error {
21192120
item := it.Item()

gql/parser_fuzz.go renamed to dql/parser_fuzz.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build gofuzz
12
// +build gofuzz
23

34
/*
@@ -16,13 +17,13 @@
1617
* limitations under the License.
1718
*/
1819

19-
package gql
20+
package dql
2021

2122
// GQL parser fuzzer for use with https://github.com/dvyukov/go-fuzz.
2223
//
23-
// Build: go-fuzz-build github.com/dgraph-io/dgraph/gql
24+
// Build: go-fuzz-build github.com/dgraph-io/dgraph/dql
2425
//
25-
// Run: go-fuzz -bin=./gql-fuzz.zip -workdir fuzz-data
26+
// Run: go-fuzz -bin=./dql-fuzz.zip -workdir fuzz-data
2627

2728
const (
2829
fuzzInteresting = 1

gql/parser_mutation.go renamed to dql/parser_mutation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gql
17+
package dql
1818

1919
import (
2020
"github.com/dgraph-io/dgo/v210/protos/api"

0 commit comments

Comments
 (0)