Documentation
¶
Index ¶
- Constants
- Variables
- func As[T any](res *ExecResult) (*T, error)
- func WithHTTPClient(client *http.Client) option
- type Attributes
- type Client
- func (c *Client) Delete(selector Selector, start time.Time, stop time.Time) ([]byte, error)
- func (c *Client) Exec(ctx context.Context, warpScript string) (*ExecResult, error)
- func (c *Client) Fetch(selector Selector, start time.Time, stop time.Time) ([]byte, error)
- func (c *Client) Find(selector Selector) ([]byte, error)
- func (c *Client) Meta(gtsList GTSList) ([]byte, error)
- func (c *Client) Update(gts GTSList) error
- type Datapoints
- type ExecResult
- type GTS
- type GTSList
- type Labels
- type Selector
Constants ¶
const ( HeaderErrorMessage = "X-Warp10-Error-Message" HeaderElapsed = "X-Warp10-Elapsed" HeaderErrorLine = "X-Warp10-Error-Line" HeaderFetched = "X-Warp10-Fetched" HeaderOperations = "X-Warp10-Ops" HeaderTimeUNit = "x-warp10-timeunit" )
Variables ¶
var ( NoReadTokenError = errors.New("this Warp10 call need a READ token access on the data") NoWriteTokenError = errors.New("this Warp10 call need a WRITE token access on the data") )
Functions ¶
func As ¶ added in v0.0.8
func As[T any](res *ExecResult) (*T, error)
func WithHTTPClient ¶ added in v0.0.9
Types ¶
type Client ¶
type Client struct {
Host string
Warp10Header string
ExecPath string
UpdatePath string
MetaPath string
FetchPath string
FindPath string
DeletePath string
ReadToken string
WriteToken string
// contains filtered or unexported fields
}
Client is a Warp10 client
func (*Client) Delete ¶
Delete execute a WarpScript on the backend, returning resultat as byte array if start and end are nil, assume user want to delete all datapoints Enhance parse response
func (*Client) Fetch ¶
Fetch execute a WarpScript on the backend, returning resultat as byte array Enhance parse response
func (*Client) Find ¶
Find execute a WarpScript on the backend, returning resultat as byte array Enhance parse response
type Datapoints ¶
type Datapoints [][]any
Datapoints is the sensision datapoints representation
func (*Datapoints) Add ¶
func (dps *Datapoints) Add(ts time.Time, value any) *Datapoints
Add a new point to a GTS
func (*Datapoints) AddWithGeo ¶
func (dps *Datapoints) AddWithGeo(ts time.Time, lattitude, longitude, altitude float64, value any) *Datapoints
AddWithGeo a new point to a GTS with geolocation
func (*Datapoints) Has ¶
func (dps *Datapoints) Has(ts time.Time) bool
Has look for datapoint at this time
func (*Datapoints) Remove ¶
func (dps *Datapoints) Remove(ts time.Time) *Datapoints
Remove datapoint at this time (only the first)
type ExecResult ¶ added in v0.0.5
type ExecResult struct {
// contains filtered or unexported fields
}
func (*ExecResult) Elapsed ¶ added in v0.0.5
func (e *ExecResult) Elapsed() int64
func (*ExecResult) ErrorLine ¶ added in v0.0.5
func (e *ExecResult) ErrorLine() int64
func (*ExecResult) ErrorMessage ¶ added in v0.0.5
func (e *ExecResult) ErrorMessage() string
You should not use this method as the WarpScript error should be returned as 2nd method return parameter
func (*ExecResult) Fetched ¶ added in v0.0.5
func (e *ExecResult) Fetched() int64
func (*ExecResult) Operations ¶ added in v0.0.5
func (e *ExecResult) Operations() int64
func (*ExecResult) Raw ¶ added in v0.0.5
func (e *ExecResult) Raw() []byte
func (*ExecResult) TimeUnit ¶ added in v0.0.5
func (e *ExecResult) TimeUnit() int64
type GTS ¶
type GTS struct {
// Name of the time serie
ClassName string `json:"c"`
// Key/value of the GTS labels (changing one key or his value create a new GTS)
Labels Labels `json:"l"`
// Key/value of the GTS attributes (can be setted/updated/removed without creating a new GTS)
Attributes Attributes `json:"a"`
// Timestamp of the last datapoint received on this GTS (% last activity window)
LastActivity int64 `json:"la"`
// Array of datapoints of this GTS
Values Datapoints `json:"v"`
}
GTS is the Warp10 representation of a GeoTimeSerie (GTS)
func NewGTSWithLabels ¶
NewGTSWithLabels return a nammed and labelized GTS
func ParseGTSFromBytes ¶
ParseGTSFromBytes parse sensision format into a new GTS
func ParseGTSFromString ¶
ParseGTSFromString parse an unique sensision format line into a new GTS
func (*GTS) SensisionSelector ¶
SensisionSelector return the GTS selector (class + labels (+ attributes) )
type GTSList ¶
type GTSList []*GTS
GTSList is an array of GTS
func ParseGTSArrayFromBytes ¶
ParseGTSArrayFromBytes parse sensision format into a new GTS array
func ParseGTSArrayFromString ¶
ParseGTSArrayFromString parse sensision format into a new GTS array
func (GTSList) SensisionSelectors ¶
SensisionSelectors return the GTSList selectors (class + labels (+ attributes) )