May be related to #116.
CONTEXT
Author of this request is proficient JavaScript, but not in Go. Some statements in this issue may skewed perceptions based as a total beginner in Go.
REQUEST/QUESTION
Assuming we have a schema that supports Time scalar (like you've done in TestTime), and we want to use a custom formatter using GraphQL directives.
Is there plans for our own neelance/graphql-go GraphQL server implementation to create our own directives?
For example, we could get a n days ago, by defining our own @date(...) directive;
query {
ago: addHour("2001-02-03T04:05:06Z") @date(as: "days ago")
}
// => { "ago": "6189 days ago" }
I'm aware not all types of Directives would be useful to ALL packages extending neelance/graphql-go.
It wouldn't make sense to have scalar Time exported by default.
But what I enjoyed in tests/, and the file time.go, was that I could see how I could implement my own scalar.
That would be awesome to have another example where one could see how to implement properly his own directive (e.g. @date).
OBSERVATIONS
As said in #116, it looks like the place we could append our own directives would be implemented are hidden away. I assume it's because lowerCased functions aren't exported in Go.
I see in internal/exec/selected/selected.go at line 194 how you’ve implemented @skip directive
And also how (black magic?) you’ve implemented @onQuery at internal/tests/testdata/tests.json {"schemas": []}, and ran from internal/tests/all_test.go TestAll
LINKS
Maybe you'd like to see some directives implemented in JavaScript, here is one implementation sample I found useful; lirown/graphql-custom-directives Date Formatting Directives
May be related to #116.
CONTEXT
Author of this request is proficient JavaScript, but not in Go. Some statements in this issue may skewed perceptions based as a total beginner in Go.
REQUEST/QUESTION
Assuming we have a schema that supports
Timescalar (like you've done in TestTime), and we want to use a custom formatter using GraphQL directives.Is there plans for our own
neelance/graphql-goGraphQL server implementation to create our own directives?For example, we could get a
n days ago, by defining our own@date(...)directive;I'm aware not all types of Directives would be useful to ALL packages extending
neelance/graphql-go.It wouldn't make sense to have scalar Time exported by default.
But what I enjoyed in
tests/, and the filetime.go, was that I could see how I could implement my own scalar.That would be awesome to have another example where one could see how to implement properly his own directive (e.g.
@date).OBSERVATIONS
As said in #116, it looks like the place we could append our own directives would be implemented are hidden away. I assume it's because
lowerCasedfunctions aren't exported in Go.I see in internal/exec/selected/selected.go at line 194 how you’ve implemented
@skipdirectiveAnd also how (black magic?) you’ve implemented
@onQueryat internal/tests/testdata/tests.json{"schemas": []}, and ran from internal/tests/all_test.go TestAllLINKS
Maybe you'd like to see some directives implemented in JavaScript, here is one implementation sample I found useful; lirown/graphql-custom-directives Date Formatting Directives