Skip to content

Commit

Permalink
Updated addTable function to create a new variable that would create …
Browse files Browse the repository at this point in the history
…the type that has not_null for id in the scenario where we query by ID
  • Loading branch information
rkrishnasanka committed Dec 4, 2023
1 parent 5d973bd commit b710dff
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions core/intro.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,18 @@ func (in *intro) addTable(t sdata.DBTable, alias string) (err error) {
in.addTypeTo("Mutation", ftM)

// add tableByID type to query and subscription
ftQS.Name += "ByID"
ftQS.addOrReplaceArg("id", newTR(KIND_NONNULL, "", newTR("", "ID", nil)))
in.addType(ftQS)
in.addTypeTo("Query", ftQS)
in.addTypeTo("Subscription", ftQS)
var ftQSByID fullType

if ftQSByID, err = in.addTableType(t, alias); err != nil {
return
}

ftQSByID.Name += "ByID"
ftQSByID.addOrReplaceArg("id", newTR(KIND_NONNULL, "", newTR("", "ID", nil)))
in.addType(ftQSByID)
in.addTypeTo("Query", ftQSByID)
in.addTypeTo("Subscription", ftQSByID)

return
}

Expand Down

0 comments on commit b710dff

Please sign in to comment.