We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Could support for CUIDs and NanoIds be added? Can be used in the same way as uuid:
import { cuid, CUID, NanoId, nanoId, PrimaryKey } from '@deepkit/type'; class User { cuid: CUID & PrimaryKey = cuid(); // Or the following // nanoId: NanoID & PrimaryKey = nanoId(); }
This would be nice to have to shorten ids.
The text was updated successfully, but these errors were encountered:
I think string would be enough, no?
class User { cuid: string & PrimaryKey = cuid(); }
Sorry, something went wrong.
I guess so, it wouldn't be able to validate the field though would it?
The @paralleldrive/cuid2 package exposes an isCuid function so it should be trivial to add validation if I'm not mistaken?
@paralleldrive/cuid2
isCuid
import { createId, isCuid } from '@paralleldrive/cuid2'; console.log( isCuid(createId()), // true isCuid('not a cuid'), // false );
True, no validation happens. When we add a new type like CUID we can add validation logic like so https://github.com/deepkit/deepkit-framework/blob/master/packages/type/src/serializer.ts#L1865-L1871 and https://github.com/deepkit/deepkit-framework/blob/master/packages/type/src/serializer.ts#L2050-L2054
CUID
No branches or pull requests
Could support for CUIDs and NanoIds be added?
Can be used in the same way as uuid:
This would be nice to have to shorten ids.
The text was updated successfully, but these errors were encountered: