Closed ThomasDeutsch closed 9 years ago
Care to provide a PR? It should be trivial
On Sat, Jun 27, 2015 at 3:34 PM Thomas Deutsch notifications@github.com wrote:
I would love to have the option to pass a optional timestamp to the squuid constructor.
one example scenario: I store all entities in firebase. For every entity, the key is the squuid from datascript. The value is a transit-string. If every squuid will contain the due-date of that item ( not the creation-time ) - the backend server will be able to detect all the items with that due-date without the need to transit every value. This would be perfect for many cron-jobs.
— Reply to this email directly or view it on GitHub https://github.com/tonsky/datascript/issues/95.
I think this is not correct - damn, sorry. I am working on a new pull request.
Decided to go with my own patch — yours has a bug, it was faster to fix it by myself: https://github.com/tonsky/datascript/commit/f2f05fa7ef956358ef5680e861b11a6e84087be3
Note that only seconds, not milliseconds, go to squuid (so they fit into 32 bit). Also note that the purpose of squuid was to provide monotonic unique decentralized identities. The fact that they’re using time is just a coincidence. It would be reasonable not to rely on that, and store timestamp explicitly. I’m adding sqquid/1 mostly for the symmetry of the API.
Thank you very mutch. Sorry about not getting it right.
2015-07-19 15:03 GMT+02:00 Nikita Prokopov notifications@github.com:
Decided to go with my own patch — yours has a bug, it was faster to fix it by myself: f2f05fa https://github.com/tonsky/datascript/commit/f2f05fa7ef956358ef5680e861b11a6e84087be3
Note that only seconds, not milliseconds, go to squuid (so they fit into 32 bit). Also note that the purpose of squuid was to provide monotonic unique decentralized identities. The fact that they’re using time is just a coincidence. It would be reasonable not to rely on that, and store timestamp explicitly. I’m adding sqquid/1 mostly for the symmetry of the API.
— Reply to this email directly or view it on GitHub https://github.com/tonsky/datascript/issues/95#issuecomment-122660061.
I would love to have the option to pass a optional timestamp to the squuid constructor.
one example scenario: I store all entities in firebase. For every entity, the key is the squuid from datascript. The value is a transit-string. If every squuid would contain the due-date of that item ( not the creation-time ) - the backend server will be able to detect all the items with that due-date without the need to transit every value. This would be perfect for many cron-jobs.
This is my Server-DB architecture: