Skip to content
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

Add @type directive to enforce type constraints. #3003

Merged
merged 3 commits into from
Feb 12, 2019

Conversation

martinmr
Copy link
Contributor

@martinmr martinmr commented Feb 11, 2019

Predicates in queries can now have a @type predicate that enforces
that all the given results are of the given type. For now this is
just the equivalent of filtering using the existing type function but
later more checks will be added.


This change is Reviewable

Predicates in queries can now have a @type predicate that enforces
that all the given results are of the given type. For now this is
just the equivalent of filtering using the existing type function but
later more checks will be added.
@martinmr martinmr requested a review from a team February 11, 2019 21:50
gql/parser.go Outdated Show resolved Hide resolved
gql/parser.go Outdated Show resolved Hide resolved
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Wao! I wouldn't have imagined this would be such a simple change for such useful functionality.

One comment. Address that before merging.

Reviewed 3 of 4 files at r1, 1 of 1 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @golangcibot)


gql/parser.go, line 2148 at r1 (raw file):

Previously, golangcibot (Bot from GolangCI) wrote…

Error return value of parseType is not checked (from errcheck)

if err := ..; err != nil { return err } please.

Copy link
Contributor Author

@martinmr martinmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @golangcibot)


gql/parser.go, line 2148 at r1 (raw file):

Previously, manishrjain (Manish R Jain) wrote…

if err := ..; err != nil { return err } please.

Done. I had fixed it already but I guess the comment is not resolved automatically.


gql/parser.go, line 2151 at r2 (raw file):

Previously, golangcibot (Bot from GolangCI) wrote…

File is not goimports-ed (from goimports)

Done.

@martinmr martinmr merged commit 3fcd13b into master Feb 12, 2019
@martinmr martinmr deleted the martinmr/type-directive-query branch February 12, 2019 01:15
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
Predicates in queries can now have a @type predicate that enforces
that all the given results are of the given type. For now this is
just the equivalent of filtering using the existing type function but
later more checks will be added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants