mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
68df83c86d
commit
bb9ae04bd8
@ -5,7 +5,7 @@ import "strings"
|
||||
type selectQuery struct {
|
||||
fields []string // SELECT xyz
|
||||
from string // FROM object
|
||||
limit int
|
||||
limit int64
|
||||
oneExtra bool
|
||||
|
||||
where []string
|
||||
|
@ -749,7 +749,7 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
|
||||
fields: fields,
|
||||
from: "entity", // the table
|
||||
args: []interface{}{},
|
||||
limit: int(r.Limit),
|
||||
limit: r.Limit,
|
||||
oneExtra: true, // request one more than the limit (and show next token if it exists)
|
||||
}
|
||||
entityQuery.addWhere("tenant_id", user.OrgID)
|
||||
@ -780,11 +780,6 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
|
||||
|
||||
query, args := entityQuery.toQuery()
|
||||
|
||||
fmt.Printf("\n\n-------------\n")
|
||||
fmt.Printf("%s\n", query)
|
||||
fmt.Printf("%v\n", args)
|
||||
fmt.Printf("\n-------------\n\n")
|
||||
|
||||
rows, err := s.sess.Query(ctx, query, args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -820,7 +815,7 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
|
||||
}
|
||||
|
||||
// found one more than requested
|
||||
if len(rsp.Results) >= entityQuery.limit {
|
||||
if int64(len(rsp.Results)) >= entityQuery.limit {
|
||||
// TODO? should this encode start+offset?
|
||||
rsp.NextPageToken = oid
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user