k1LoW / runn

runn is a package/tool for running operations following a scenario.
https://runn.run
MIT License
417 stars 30 forks source link

[Feature request] Time instance creation built-in functions #926

Closed h6ah4i closed 3 months ago

h6ah4i commented 3 months ago

I want to test APIs that use UNIX timestamps. Is there a chance to add time#Unix(), time#UnixMilli(), and time#UnixMicro() as built-in functions?

FYI: We can parse datetime strings using the date() function that expr provides, but it does not support parsing UNIX timestamps.

k1LoW commented 3 months ago

Looks good, I thought it would be good to implement a similar configuration to faker.

On the other hand, the currently existing time() can also manipulate Unix timestamps, so a careful transition based on use cases is necessary.

h6ah4i commented 3 months ago

On the other hand, the currently existing time() can also manipulate Unix timestamps, so a careful transition based on use cases is necessary.

Wow! I have't noticed that because the time() built-in is not listed on the README section. Can you add this to help people can easily find the function?

k1LoW commented 3 months ago

Added! 👍