influxdata / influxdata/kapacitor

Problem with some functions in lambda expression

Open
#2,294 4 comments 1 reaction 1 assignee Claimed by @samhld View on GitHub
pm/review
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

Hi,

I am using docker image `kapacitor:1.5.3`
I was trying to use some functions inside lambda expression and got results different than expected eg:
- `int(30s)` - in your documentation it states that:

> Converts a string or float64 into an int64 via Golang’s strconv.ParseInt or simple int64() coercion. Strings are assumed to be decimal numbers. **Durations are converted into an int64 with nanoseconds units**. A Boolean is converted to an int64 where false -> 0 and true -> 1.

but I'm getting error `Cannot call function \"int\" with args (30s: duration), available signatures are [(int), (float), (boolean), (string)].`
- `now() - 30s` - results in error `invalid math operator - for type time`, should this operation be valid?

Is there any other way than using `unixNano(now()) - unixNano("time")` to do basic math operations on time types?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.