Fixing page limit on cosmosdb
Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com>
This commit is contained in:
parent
acf698ee4b
commit
0b8d937ccd
|
|
@ -147,9 +147,10 @@ func (q *Query) setNextParameter(val string) string {
|
|||
func (q *Query) execute(client *azcosmos.ContainerClient) ([]state.QueryItem, string, error) {
|
||||
opts := &azcosmos.QueryOptions{}
|
||||
|
||||
resultLimit := q.limit
|
||||
opts.QueryParameters = append(opts.QueryParameters, q.query.parameters...)
|
||||
if q.limit != 0 {
|
||||
opts.PageSizeHint = int32(q.limit)
|
||||
opts.PageSizeHint = int32(resultLimit)
|
||||
}
|
||||
if len(q.token) != 0 {
|
||||
opts.ContinuationToken = q.token
|
||||
|
|
@ -175,8 +176,14 @@ func (q *Query) execute(client *azcosmos.ContainerClient) ([]state.QueryItem, st
|
|||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
if (len(items) + 1) > resultLimit {
|
||||
break
|
||||
}
|
||||
items = append(items, tempItem)
|
||||
}
|
||||
if (len(items) + 1) > resultLimit {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
ret := make([]state.QueryItem, len(items))
|
||||
|
|
|
|||
Loading…
Reference in New Issue