Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Commit

Permalink
Define a default limit for all subqueries
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarfors committed May 27, 2021
1 parent 4fadef7 commit f4a22d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions store/postgres_graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
)

const (
orderAsc string = "ASC"
orderDesc string = "DESC"
orderAsc string = "ASC"
orderDesc string = "DESC"
defaultLimit uint64 = 100
)

// tableColumns is used to store the columns that are SELECT'd in a SQl
Expand Down Expand Up @@ -329,6 +330,10 @@ func psqlSubQuery(tenant string, graph *SchemaGraph, sql *sq.SelectBuilder, pare
}
}

// Set a default limit on each query
if limitArg == nil {
nodeQuery = nodeQuery.Limit(defaultLimit)
}
if limitArg != nil {
limitStr, ok := limitArg.Value.GetValue().(string)
if !ok {
Expand Down

0 comments on commit f4a22d0

Please sign in to comment.