Hi,
I’m using Fauna via a server that implements API (and not directly from the client).
Is there a best-practice how to send after/before cursors to the client?
I don’t like their form because:
- They are JSON object and not simple string that you can easily add to query param
- They expose the internal structure of your DB like collection or index names
I thought maybe strip the unnecessary clutter and stay just with IDs, and then base64 encode it.
E.g. this cursor:
[
Time("2020-09-22T14:51:08.656555Z"),
Ref(Collection("FormSubmits"), "277377102731280915"),
Ref(Collection("FormSubmits"), "277377102731280915")
]
will become:
["2020-09-22T14:51:08.656555Z","277377102731280915","277377102731280915"]
and after encoding
WyIyMDIwLTA5LTIyVDE0OjUxOjA4LjY1NjU1NVoiLCIyNzczNzcxMDI3MzEyODA5MTUiLCIyNzczNzcxMDI3MzEyODA5MTUiXQ==
On the decode side I’ll have to have the logic that the first item in the array has to be wrapped with Time(X)
,the second and third with Ref(Collection("FormSubmits"), X)
So it doesn’t solve #2 fully, just hides it from the naked eye, and also requires custom implementation.
Is there any other way that is recommended?
Thanks