Repeatedly, the handling of time and date using nanoseconds has gotten people stumbling.
The situation could perhaps be improved if we had some rego-only helper methods? I'm imaging something like
days(n) = x {
x := n * hours(24)
}
hours(n) = x {
x := n * minutes(60)
}
minutes(n) = x {
x := n * seconds(60)
}
seconds(n) = x {
x := n * 1000000000
}
So that you could write time.now_ns() - time.days(1) etc.
This would be similar to how golang does it in time's constants.
Repeatedly, the handling of time and date using nanoseconds has gotten people stumbling.
The situation could perhaps be improved if we had some rego-only helper methods? I'm imaging something like
So that you could write
time.now_ns() - time.days(1)etc.This would be similar to how golang does it in
time's constants.