mirror of
https://github.com/FlipsideCrypto/flip-rpc-client-go.git
synced 2026-02-06 10:56:45 +00:00
Add ttl option to dynamic query.
This commit is contained in:
parent
0fc6ade7c4
commit
b7e5d49a42
@ -133,7 +133,7 @@ func TestClient_IntersectMembersToSegment(t *testing.T) {
|
||||
func TestClient_ExecuteDynamicQuery(t *testing.T) {
|
||||
client := getClient(t)
|
||||
|
||||
resp, err := client.ExecuteDynamicQuery(makeQuery(makeCondition()), false)
|
||||
resp, err := client.ExecuteDynamicQuery(makeQuery(makeCondition()), false, 10)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@ -149,7 +149,7 @@ func TestClient_ExecuteDynamicQuery(t *testing.T) {
|
||||
func TestClient_ExecuteDynamicQueryWithWindowing(t *testing.T) {
|
||||
client := getClient(t)
|
||||
|
||||
resp, err := client.ExecuteDynamicQuery(makeWindowingQuery(), false)
|
||||
resp, err := client.ExecuteDynamicQuery(makeWindowingQuery(), false, 10)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@ -170,7 +170,7 @@ func TestClient_ExecuteDynamicQueryWithError(t *testing.T) {
|
||||
client := getClient(t)
|
||||
query := makeQuery(makeCondition())
|
||||
query.Table = "foobar"
|
||||
resp, err := client.ExecuteDynamicQuery(query, false)
|
||||
resp, err := client.ExecuteDynamicQuery(query, false, 10)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
|
||||
@ -11,14 +11,18 @@ type ExecuteDynamicQueryResponse struct {
|
||||
Results []interface{} `mapstructure:"results" json:"results"`
|
||||
ResultCount int `mapstructure:"result_count" json:"result_count"`
|
||||
CompiledSQL string `mapstructure:"compiled_sql" json:"compiled_sql,omitempty"`
|
||||
TTLHash string `mapstructure:"ttl_hash" json:"ttl_hash,omitempty"`
|
||||
TTLStart string `mapstructure:"ttl_start" json:"ttl_start,omitempty"`
|
||||
TTLExpiry string `mapstructure:"ttl_expiry" json:"ttl_expiry,omitempty"`
|
||||
Error string `mapstructure:"error,omitempty" json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// ExecuteDynamicQuery returns the query results
|
||||
func (c Client) ExecuteDynamicQuery(query dynamicquery.Query, debug bool) (*ExecuteDynamicQueryResponse, error) {
|
||||
func (c Client) ExecuteDynamicQuery(query dynamicquery.Query, debug bool, ttlSeconds int) (*ExecuteDynamicQueryResponse, error) {
|
||||
var input = make(map[string]interface{})
|
||||
input["query"] = query
|
||||
input["debug"] = debug
|
||||
input["ttl_seconds"] = ttlSeconds
|
||||
|
||||
var response ExecuteDynamicQueryResponse
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user