I much prefer having datetime() with no parameters return the current server
date/time. This also keeps the function similar in nature to other query
languages (e.g. Cypher). I have had several Gremlin users tell me they were
surprised when it did not already behave that way wen they tried it as it
seemed "obvious to them" that that is how it would work.
Cheers, Kelvin
On Tuesday, September 26, 2023 at 07:33:57 PM CDT, Valentyn Kahamlyk
<[email protected]> wrote:
Hi all,
Currently, when using a gremlin, there is no way to use the current
server time in requests. This can be convenient for storing the
creation or update date of elements. Also may be useful when examining
query performance.
I propose adding this feature.
There are some ways to implement it
1. Add a new step `currentDateTime()` which will return the current UTC time.
pros: compatible with both bytecode and gremlin
cons: one more step
2. Extend `inject` step to accept some kind of tokens, for example
`inject(DT.now)` or `inject(DT.utcnow)`
pros: can be reused existing step
cons: not feel like gremlin
3. Extend `datetime()` function to return current time without arg.
pros: clean and easy to implement
cons: not compatible with bytecode, what I consider as a blocker
I plan to implement option 1 if there are no objections.
What do you think?
Regards, Valentyn