Object Ids
Every object is uniquely identifiable, by a standardized UUIDv7.
This datatype works across MSSQL, PostgreSQL, SQLite, and Typescript/JavaScript (as string).
In Service and Storage
In API, services, and backend storage, an object's ID is created as an UUIDv7.
And, it is handled and stored as a GUID.
Id Over The Wire
Over the wire, an object id can be passed in Guid form.
But a more useful way is to return it in a form, similar to a MoRef.
This is a two-term string of type and Id:
<objecttype>:<objectid>
The type is a shorthand type, recognizable by a UI.
And, the objectid is a condensed version of the object's Id (its UUIDv7 Id).
This objectid is encoded with the NanoId library, which creates condensed Base64 versions of UUID.
Benefits
Here are the benefits of the design choice, above.
- Resources/Object are identified by UUIDv7.
- A UUIDv7 is time sortable.
- It is an acceptable key type for PostgreSQL, MSSQL, SQLite, and JS libraries.
- Client UIs can mint object Ids, that are acceptable by the backend.
No Comments