ID generator with deterministic modes for testing.
Generates unique identifiers with support for different modes:
// Production: real UUIDsconst idService = new IdService(IDMode.UUID);const id = idService.NextId(); // "550e8400-e29b-41d4-a716-446655440000"// Testing: constant IDconst constId = new IdService(IDMode.CONST);const id1 = constId.NextId(); // "VeryUniqueID"const id2 = constId.NextId(); // "VeryUniqueID"// Testing: stepped sequenceconst stepId = new IdService(IDMode.STEP);const id1 = stepId.NextId(); // "STEPId-0"const id2 = stepId.NextId(); // "STEPId-1" Copy
// Production: real UUIDsconst idService = new IdService(IDMode.UUID);const id = idService.NextId(); // "550e8400-e29b-41d4-a716-446655440000"// Testing: constant IDconst constId = new IdService(IDMode.CONST);const id1 = constId.NextId(); // "VeryUniqueID"const id2 = constId.NextId(); // "VeryUniqueID"// Testing: stepped sequenceconst stepId = new IdService(IDMode.STEP);const id1 = stepId.NextId(); // "STEPId-0"const id2 = stepId.NextId(); // "STEPId-1"
Optional
Readonly
Generates the next unique identifier.
Unique ID string based on the configured mode
ID generator with deterministic modes for testing.
Generates unique identifiers with support for different modes:
Example