Skip to content

feat: add EXISTS/NOT_EXISTS subquery logical where criteria expressions #151

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

Merged
merged 12 commits into from
Jun 11, 2019

Conversation

igdianov
Copy link
Collaborator

@igdianov igdianov commented Jun 11, 2019

This PR adds support for EXISTS / NOT_EXISTS subquery logical where criteria expressions, i.e. given:

query {
  Tasks(where: {
    status: {EQ: COMPLETED}
    AND: [{
      EXISTS: {
        variables: {
          name: {EQ: "variable1"}
          value: {EQ: "data"}
        }
      }
    } {
      EXISTS: {
        variables: {
          name: {EQ: "variable2"}
          value: {EQ: true}
        }
      }
    }]
  }) {
    select {
      id
      status
      variables {
        name
        value
      }
    }
  }
}

Will return task entity if there exists both variables with name and values:

{
  "data": {
    "Tasks": {
      "select": [
        {
          "id": "1",
          "status": "COMPLETED",
          "variables": [
            {
              "name": "variable1",
              "value": "data"
            },
            {
              "name": "variable2",
              "value": true
            }
          ]
        }
      ]
    }
}

Alternative implicit AND EXISTS subquery list criteria expression:

query {
  Tasks(where: {
    status: {EQ: COMPLETED}
    EXISTS: [{
      variables: {
        name: {EQ: "variable1"}
        value: {EQ: "data"}
      }
    } {
      variables: {
        name: {EQ: "variable2"}
        value: {EQ: true}
      }
    }]
  }) {
    select {
      id
      status
      variables {
        name
        value
      }
    }
  }
}

@igdianov igdianov self-assigned this Jun 11, 2019
@codecov
Copy link

codecov bot commented Jun 11, 2019

Codecov Report

Merging #151 into master will increase coverage by 1.33%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #151      +/-   ##
============================================
+ Coverage     68.23%   69.56%   +1.33%     
- Complexity      440      450      +10     
============================================
  Files            33       33              
  Lines          2254     2343      +89     
  Branches        337      343       +6     
============================================
+ Hits           1538     1630      +92     
+ Misses          578      576       -2     
+ Partials        138      137       -1
Impacted Files Coverage Δ Complexity Δ
...a/query/schema/impl/QraphQLJpaBaseDataFetcher.java 73.98% <100%> (+2.33%) 156 <0> (+7) ⬆️
...entures/graphql/jpa/query/schema/impl/Logical.java 100% <100%> (ø) 3 <0> (ø) ⬇️
...jpa/query/schema/impl/GraphQLJpaSchemaBuilder.java 88.76% <100%> (+1.08%) 123 <3> (+3) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17e0189...23bb448. Read the comment docs.

@igdianov igdianov merged commit 85d2f3a into master Jun 11, 2019
@igdianov igdianov deleted the igdianov-exists-criteria branch June 11, 2019 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant