mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
feat: adding initial uuid support
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
*/
|
||||
import type { Generated } from "kysely";
|
||||
|
||||
export type PrimaryFieldType<IdType extends number = number> = IdType | Generated<IdType>;
|
||||
export type PrimaryFieldType<IdType = number | string> = IdType | Generated<IdType>;
|
||||
|
||||
export interface AppEntity<IdType extends number = number> {
|
||||
export interface AppEntity<IdType = number | string> {
|
||||
id: PrimaryFieldType<IdType>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { v4, v7 } from "uuid";
|
||||
|
||||
// generates v4
|
||||
export function uuid(): string {
|
||||
return crypto.randomUUID();
|
||||
return v4();
|
||||
}
|
||||
|
||||
export function uuidv7(): string {
|
||||
return v7();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user