mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-06 00:25:55 +00:00
move ExecuteQuery to client that every other benchmark can use
This commit is contained in:
parent
743706858b
commit
602a34ef6e
2 changed files with 12 additions and 11 deletions
|
|
@ -2,8 +2,9 @@ package bench
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pilosa/pilosa"
|
||||
"context"
|
||||
"errors"
|
||||
)
|
||||
|
||||
func firstHostClient(hosts []string) (*pilosa.Client, error) {
|
||||
|
|
@ -56,4 +57,14 @@ func (h *HasClient) Init(hosts []string, agentNum int) error {
|
|||
}
|
||||
}
|
||||
|
||||
func (h *HasClient) ExecuteQuery(contentType, db, query string, ctx context.Context) (interface{}, error) {
|
||||
if contentType == "protobuf" {
|
||||
return h.client.ExecuteQuery(ctx, db, query, true)
|
||||
} else if contentType == "pql" {
|
||||
return h.client.ExecutePQL(ctx, db, query)
|
||||
} else {
|
||||
return nil, errors.New("unsupport content type")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import (
|
|||
"io/ioutil"
|
||||
"strings"
|
||||
"time"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// RandomQuery queries randomly and deterministically based on a seed.
|
||||
|
|
@ -119,12 +118,3 @@ func (b *RandomQuery) Run(ctx context.Context) map[string]interface{} {
|
|||
return results
|
||||
}
|
||||
|
||||
func (b *RandomQuery) ExecuteQuery(contentType, db, query string, ctx context.Context, ) (interface{}, error) {
|
||||
if contentType == "protobuf" {
|
||||
return b.client.ExecuteQuery(ctx, db, query, true)
|
||||
} else if contentType == "pql" {
|
||||
return b.client.ExecutePQL(ctx, db, query)
|
||||
} else {
|
||||
return nil, errors.New("unsupport content type")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue