chore: add csharpier to husky, format backend with csharpier
This commit is contained in:
parent
5fab66444f
commit
7f971e8549
73 changed files with 2098 additions and 1048 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue