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 {
|
type selectQuery struct {
|
||||||
fields []string // SELECT xyz
|
fields []string // SELECT xyz
|
||||||
from string // FROM object
|
from string // FROM object
|
||||||
limit int
|
limit int64
|
||||||
oneExtra bool
|
oneExtra bool
|
||||||
|
|
||||||
where []string
|
where []string
|
||||||
|
@ -749,7 +749,7 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
|
|||||||
fields: fields,
|
fields: fields,
|
||||||
from: "entity", // the table
|
from: "entity", // the table
|
||||||
args: []interface{}{},
|
args: []interface{}{},
|
||||||
limit: int(r.Limit),
|
limit: r.Limit,
|
||||||
oneExtra: true, // request one more than the limit (and show next token if it exists)
|
oneExtra: true, // request one more than the limit (and show next token if it exists)
|
||||||
}
|
}
|
||||||
entityQuery.addWhere("tenant_id", user.OrgID)
|
entityQuery.addWhere("tenant_id", user.OrgID)
|
||||||
@ -780,11 +780,6 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
|
|||||||
|
|
||||||
query, args := entityQuery.toQuery()
|
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...)
|
rows, err := s.sess.Query(ctx, query, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -820,7 +815,7 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
|
|||||||
}
|
}
|
||||||
|
|
||||||
// found one more than requested
|
// found one more than requested
|
||||||
if len(rsp.Results) >= entityQuery.limit {
|
if int64(len(rsp.Results)) >= entityQuery.limit {
|
||||||
// TODO? should this encode start+offset?
|
// TODO? should this encode start+offset?
|
||||||
rsp.NextPageToken = oid
|
rsp.NextPageToken = oid
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user