-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add DateTime custom scalars #931
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questions...
Note: I haven't officially looked yet, but the Change Detection tests are likely failing because there was a schema change of one of the integration test objects. Not 100% sure how to best define that issue on the change detection file since its not related to the core function of the database, but just breaks a test from one version to another. cc: @AndrewSisley |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good minus some localized issues (and the inherent awkwardness of the solution which has been discussed already and is out of scope).
There should be a few examples of this in the change-documentation directory already. Just be really sure you havent actually changed anything first (suggest doing this right before merging, just in case) |
Just a quick sanity check - you are not persisting Time as strings in the datastore correct? |
Realized I haven't looked that persistence w.r.t DateTime. Its very possible that it actually is off the top of my head, would need to confirm. The options for DB persistence is 1) RFC3339 formatted stings (as its doing now), 2) convert to unixtime (millis). Strings are obvi far more space, so we should prob do unixtime serialize uint64 as I think your likely suggesting here. |
Can you expand on this comment, missed it during my first review @AndrewSisley |
Codecov Report
@@ Coverage Diff @@
## develop #931 +/- ##
===========================================
- Coverage 60.35% 60.19% -0.16%
===========================================
Files 164 165 +1
Lines 17732 17884 +152
===========================================
+ Hits 10702 10766 +64
- Misses 6082 6155 +73
- Partials 948 963 +15
|
This is RE the convo we had before, where other alternative solutions involved changing the gql parsing logic (currently the gql-fork), or doing this somewhere a little more isolated (a func that would have to re-traverse the tree - doing roughly what this PR does, but in a more isolated code block at the cost of some performance and the ugliness of iterating/parsing it in an extra step) |
3c4b2c6
to
de664e5
Compare
de664e5
to
374e92c
Compare
Adds support for DateTime custom scalar types in schemas and filter query arguments. At the moment this doesn't support NonNull DateTimes yet.
Relevant issue(s)
Resolves #676
Description
Adds support for DateTime custom scalar types in schemas and filter query arguments. At the moment this doesn't support NonNull DateTimes, as I wanted to implement as a follow-up PR in case the core design had push back.
There's a few points of attention, identified by
@TODO
asking for design input. Most notably on theschema
object access within a CollectionAPI call, which has to use a type cast from the parser, and the parser schema manager being public.There was also a need to update 1)
int64
toint
and 2)gql.NullValue export for input argument value parsing due to the use of the new GQL value coercion.The general implementation revolves around a newly exposed API on the GQL lib called
ValueFromAST
andGetFieldType
, which will convert an AST type to a Go native type when provided the coorespondinggql.Input
type from the Schema.Commits are fairly clean and in order of work.
PS. Theres a decent number of code changes which I would usually like to avoid just to implement DateTime. But this requires a new way to parse gql input objects which includes any custom scalars. Theres just the addition of glue code for defining the
FieldKinds
and the connor evaluation types.Tasks
How has this been tested?
Specify the platform(s) on which this was tested: