chore: add csharpier to husky, format backend with csharpier

This commit is contained in:
sam 2024-10-02 00:28:07 +02:00
parent 5fab66444f
commit 7f971e8549
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
73 changed files with 2098 additions and 1048 deletions

View file

@ -32,14 +32,20 @@ public class SnowflakeGenerator : ISnowflakeGenerator
var threadId = Environment.CurrentManagedThreadId % 32;
var timestamp = time.Value.ToUnixTimeMilliseconds() - Snowflake.Epoch;
return (timestamp << 22) | (uint)(_processId << 17) | (uint)(threadId << 12) | (increment % 4096);
return (timestamp << 22)
| (uint)(_processId << 17)
| (uint)(threadId << 12)
| (increment % 4096);
}
}
public static class SnowflakeGeneratorServiceExtensions
{
public static IServiceCollection AddSnowflakeGenerator(this IServiceCollection services, int? processId = null)
public static IServiceCollection AddSnowflakeGenerator(
this IServiceCollection services,
int? processId = null
)
{
return services.AddSingleton<ISnowflakeGenerator>(new SnowflakeGenerator(processId));
}
}
}