forked from graph-gophers/graphql-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of graph-gophers#434 and related to graph-gophers#116 this change adds a new package containing all types used by graphql-go in representing the GraphQL specification. The names used in this package should match the specification as closely as possible. In order to have cohesion, all internal packages that use GraphQL types have been changed to use this new package. This change is large but mostly mechanical. I recommend starting by reading through the `types` package to build familiarity. I'll call out places in the code where I made decisions and what the tradeoffs were.
- Loading branch information
Showing
38 changed files
with
1,271 additions
and
1,127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,18 @@ | ||
package common | ||
|
||
type Directive struct { | ||
Name Ident | ||
Args ArgumentList | ||
} | ||
import "github.com/graph-gophers/graphql-go/types" | ||
|
||
func ParseDirectives(l *Lexer) DirectiveList { | ||
var directives DirectiveList | ||
func ParseDirectives(l *Lexer) types.DirectiveList { | ||
var directives types.DirectiveList | ||
for l.Peek() == '@' { | ||
l.ConsumeToken('@') | ||
d := &Directive{} | ||
d := &types.Directive{} | ||
d.Name = l.ConsumeIdentWithLoc() | ||
d.Name.Loc.Column-- | ||
if l.Peek() == '(' { | ||
d.Args = ParseArguments(l) | ||
d.Arguments = ParseArgumentList(l) | ||
} | ||
directives = append(directives, d) | ||
} | ||
return directives | ||
} | ||
|
||
type DirectiveList []*Directive | ||
|
||
func (l DirectiveList) Get(name string) *Directive { | ||
for _, d := range l { | ||
if d.Name.Name == name { | ||
return d | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.