-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip related to implementing executor.execute func
- Loading branch information
1 parent
e12d9d9
commit a9ec103
Showing
5 changed files
with
104 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package executor | ||
|
||
import ( | ||
"github.com/chris-ramon/graphql-go/language/ast" | ||
"github.com/chris-ramon/graphql-go/types" | ||
) | ||
|
||
//export function getVariableValues( | ||
//schema: GraphQLSchema, | ||
//definitionASTs: Array<VariableDefinition>, | ||
//inputs: { [key: string]: any } | ||
//): { [key: string]: any } { | ||
//return definitionASTs.reduce((values, defAST) => { | ||
//var varName = defAST.variable.name.value; | ||
//values[varName] = getVariableValue(schema, defAST, inputs[varName]); | ||
//return values; | ||
//}, {}); | ||
//} | ||
|
||
func GetVariableValues(schema types.GraphQLSchema, definitionASTs []ast.VariableDefinition, inputs map[string]interface{}) (r map[string]interface{}) { | ||
//TODO: use reduce | ||
return r | ||
} |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package fd | ||
|
||
import ( | ||
. "github.com/chris-ramon/graphql-go/language/ast" | ||
) | ||
|
||
type FragmentDefinition struct { | ||
Kind string | ||
Loc Location | ||
Operation string | ||
Name Name | ||
VariableDefinitions []VariableDefinition | ||
TypeCondition Name | ||
Directives []Directive | ||
SelectionSet SelectionSet | ||
} | ||
|
||
func NewFragmentDefinition() *FragmentDefinition { | ||
return &FragmentDefinition{ | ||
Kind: "FragmentDefinition", | ||
} | ||
} | ||
|
||
func GetKind(fd *FragmentDefinition) string { | ||
return fd.Kind | ||
} | ||
|
||
func GetLoc(fd *FragmentDefinition) Location { | ||
return fd.Loc | ||
} | ||
|
||
func GetOperation(fd *FragmentDefinition) string { | ||
return fd.Operation | ||
} | ||
|
||
func GetName(fd *FragmentDefinition) Name { | ||
return fd.Name | ||
} | ||
|
||
func GetTypeCondition(fd *FragmentDefinition) Name { | ||
return fd.TypeCondition | ||
} | ||
|
||
func GetVariableDefinitions(fd *FragmentDefinition) []VariableDefinition { | ||
return fd.VariableDefinitions | ||
} | ||
|
||
func GetDirectives(fd *FragmentDefinition) []Directive { | ||
return fd.Directives | ||
} | ||
|
||
func GetSelectionSet(fd *FragmentDefinition) SelectionSet { | ||
return fd.SelectionSet | ||
} |
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