Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dailydevops/sequentialguid

Simple and high-performance solution for creating sequential GUIDs. Does not fulfill the security requirements like GUIDs.
https://github.com/dailydevops/sequentialguid

dotnet sequential-guids

Last synced: about 1 month ago
JSON representation

Simple and high-performance solution for creating sequential GUIDs. Does not fulfill the security requirements like GUIDs.

Awesome Lists containing this project

README

        

# NetEvolve.SequentialGuid

[![Nuget](https://img.shields.io/nuget/v/NetEvolve.SequentialGuid?logo=nuget)](https://www.nuget.org/packages/NetEvolve.SequentialGuid/)
[![Nuget](https://img.shields.io/nuget/dt/NetEvolve.SequentialGuid?logo=nuget)](https://www.nuget.org/packages/NetEvolve.SequentialGuid/)

A .NET library to generate sequential GUIDs, similar to SQL Server's `newsequentialid()`.
It's a drop-in replacement for `System.Guid.NewGuid()`, focusing on performance and low allocation.

> [!CAUTION]
> The downside is that it's not as unique as `System.Guid.NewGuid()` and crypotographically insecure.
> So be sure to understand the trade-offs before using it.

## Features
With the `SequentialGuidType` enum, you can choose between 3 different types of sequential GUIDs:
- `AsBinary`
The sequential part is at the beginning of the GUID, similar to Oracle's `SYS_GUID()`.
- `AsString` (Default)
The sequential part is at the beginning of the GUID.
- `AtEnd`
The sequential part is at the end of the GUID, similar to SQL Server's `newsequentialid()`.

## Installation

```pwsh
dotnet add package NetEvolve.SequentialGuid
```

## Usage

```csharp
using NetEvolve.SequentialGuid;

Guid guid = SequentialGuidFactory.NewGuid(); // Default is SequentialGuidType.AsString
// or
Guid guid = SequentialGuidFactory.NewGuid(SequentialGuidType.AsBinary);
```