lucasteles / Strongly

💪🏾 A strongly-typed domain values source-generator
MIT License
35 stars 6 forks source link

Support for unsigned integers #16

Open koryphaee opened 3 days ago

koryphaee commented 3 days ago

I am currently working on a project that uses a ulong as a central type in the business logic. It represents a 64bit image hash that needs to be saved in the database as well as queried via JSON API. I am already using this cool library for my database primary keys but can't use if for the hash yet. Using long as the backing type would technically work but it doesn't feel clean.

From what I can tell it won't be a lot of work and I will try to create the PR myself. Even though I only need ulong I would add all missing unsigned types since the overhead is minimal. These would be:

StronglyType keyword
SignedByte sbyte
UnsignedShort ushort
UnsignedInt uint
UnsignedLong ulong
NativeUnsignedInt nuint

(taken from https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types#characteristics-of-the-integral-types)

I also need XOR support to calculate the hamming distance between two hashes but this will be a separate issue: https://github.com/lucasteles/Strongly/issues/17

koryphaee commented 3 days ago

PR is done: https://github.com/lucasteles/Strongly/pull/18