I'm stuck on handling Time type data of faunaDB. I have no idea which type of golang is appropriate to map to Time type data of faunaDB.
I've tried the following code for fauna document creation:
type LabelData struct {
RedirectURL string `fauna:"redirectURL"`
Owner string `fauna:"owner"`
RedirectCount int `fauna:"redirectCount"`
ExternalID string `fauna:"externalID"`
Tag string `fauna:"Tag"`
Created int64 `fauna:created`
}
func faunaCreate(externalID string) (err error) {
var documentRef f.RefV
labelData := LabelData{
RedirectURL: "",
Owner: "",
RedirectCount: 0,
ExternalID: externalID,
Created: f.ToMillis(f.Time("now")),
}
newlabel, err := client.Query(
f.Create(
f.Collection("label"),
f.Obj{"data": labelData},
),
)
But it occurs following error:
cannot use faunadb.ToMillis(faunadb.Time("now")) (type faunadb.Expr) as type int64 in field value
Which data type for golang should I use for faunaDB Time type? Thank you for your suggestion!