added getmyjson to replaycli

nats
Paulo Simão 2021-10-11 18:21:47 -03:00
parent f3abaa694d
commit 392c7940af
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package replay
import (
"encoding/json"
"fmt"
"os"
"time"
@ -110,6 +111,14 @@ func (c *Cli) QueueGetData(id string) (ret []byte, err error) {
func (c *Cli) QueueGetMyData() ([]byte, error) {
return c.QueueGetData(os.Getenv("REPLAY_QUEUEID"))
}
func (c *Cli) QueueGetMyJson(i interface{}) error {
bs, err := c.QueueGetData(os.Getenv("REPLAY_QUEUEID"))
if err != nil {
return err
}
err = json.Unmarshal(bs, i)
return err
}
func (c *Cli) QueueAbort() error {
return c.HttpCli().JsonGet("/api/v1/queue/abort", nil)
}