/gl-dotnet-d64

[.NET Core 1.1] .NET Standard port of D64, a copy-pastable, URL friendly, ASCII embeddable, lexiographicly sortable binary encoding.

Primary LanguageC#MIT LicenseMIT

NuGet Version Build Status

Dotnet D64

This library is a .net standard port of d64. d64 is a copy-pastable, url friendly, ascii embeddable, lexiographicly sortable binary encoding.

D64Convert

D64Convert is a class providing feature very similar to native .net Convert.ToBase64String and Convert.FromBase64String(). It exposes two static methods.

Encode

static string Encode(byte[] data)

Encode takes a byte array and produces a D64 encoded string.

Decode

static byte[] Decode(string str)

Decode takes a D64 encoded string and returns the decoded byte array.

TimeBasedId

TimeBaseId is a sortable likely to be unique id generator. It is similar to guids except that they would be time sortable.

Constructor

TimebasedId(bool reverseOrder)

You can specify if you want the natural sorting order to be reversed. This might be extremely usefull when using table storage and you want the data to be ordered from most recent to oldest.

New ID

string NewId()

Generates a new Id based on DateTimeOffset.UtcNow.

string NewId(DateTimeOffset datetime)

Generates a new Id using the specified DateTimeOffset.

DateBoundary

string DateBoundat(DateTimeOffset datetime)

Generates a boundary string which can be used in comparisons to find more recent or older ids.