Ksuid 1.0.0
dotnet add package Ksuid --version 1.0.0
NuGet\Install-Package Ksuid -Version 1.0.0
<PackageReference Include="Ksuid" Version="1.0.0" />
paket add Ksuid --version 1.0.0
#r "nuget: Ksuid, 1.0.0"
// Install Ksuid as a Cake Addin
#addin nuget:?package=Ksuid&version=1.0.0
// Install Ksuid as a Cake Tool
#tool nuget:?package=Ksuid&version=1.0.0
Ksuid
This library implements the K-Sortable Globally Unique IDs from Segment. See also the article called A Brief History of the UUID.
KSUID is for K-Sortable Unique IDentifier. It's a way to generate globally unique IDs similar to RFC 4122 UUIDs, but contain a time component so they can be "roughly" sorted by time of creation. The remainder of the KSUID is randomly generated bytes.
Installation
To install Ksuid, run the following command in the Package Manager Console
PM> Install-Package Ksuid
Usage
using KSUID;
var ksuid1 = Ksuid.Generate(); // same as new Ksuid()
Console.WriteLine(ksuid1);
Console.WriteLine(ksuid1.GetTimestamp());
Console.WriteLine(ksuid1.GetUnixTimestamp());
var ksuid2 = Ksuid.FromString("0o5Fs0EELR0fUjHjbCnEtdUwQe3");
Console.WriteLine(ksuid2);
Console.WriteLine(ksuid2.GetTimestamp());
Console.WriteLine(ksuid2.GetUnixTimestamp());
var ksuid3 = new Ksuid(ksuid2.GetPayload());
Console.WriteLine(ksuid3);
Console.WriteLine(ksuid3.GetTimestamp());
Console.WriteLine(ksuid3.GetUnixTimestamp());
var ksuid4 = new Ksuid(ksuid2.GetPayload(), ksuid1.GetTimestamp());
Console.WriteLine(ksuid4);
Console.WriteLine(ksuid4.GetTimestamp());
Console.WriteLine(ksuid4.GetUnixTimestamp());
var ksuid4 = Ksuid.FromByteArray(ksuid2.ToByteArray());
Console.WriteLine(ksuid4);
License
The MIT License
More info see LICENSE
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- Base62-Net (>= 1.2.157201)
- JetBrains.Annotations (>= 2021.3.0)
- System.Runtime.Extensions (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 67,823 | 4/7/2022 |
1.0.0-build4 | 34,682 | 4/9/2018 |
1.0.0-build3 | 726 | 4/8/2018 |