Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when setting time to live on Create #83

Closed
camilopayan opened this issue Jan 14, 2020 · 1 comment
Closed

Error when setting time to live on Create #83

camilopayan opened this issue Jan 14, 2020 · 1 comment

Comments

@camilopayan
Copy link

In the documentation for Create I can see that it supports a TTL parameter, which takes a Fauna Timestamp object: https://docs.fauna.com/fauna/current/api/fql/functions/create

In the documentation for Timestamps, it says the code to use for the Go library is faunadb.Time but when I do so, I get an error saying that faunadb.Time is not a type.

I can't find Time in the code, but I have found some similar things, like TimeV. Would that be the type to use for timestamps? I see that it's basically just a wrapper around the Go stdlib time.Time object.

@rts-rob
Copy link

rts-rob commented Mar 10, 2021

Hi @camilopayan - I suggest avoiding using the TimeV type directly in your code. Instead, call f.Time() as a function, passing a ISO 8601 offset date/time (e.g., "2006-01-02T15:04:05Z"). That returns an f.Expr object with the Timestamp that you can use in the params for Create() or as an argument to the other Date/Time functions in FQL.

ts := f.Time("2006-01-02T15:04:05Z")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants