feat: upgrade to .NET 6, refactor everything

This commit is contained in:
spiral
2021-11-26 21:10:56 -05:00
parent d28e99ba43
commit 1918c56937
314 changed files with 27954 additions and 27966 deletions

View File

@@ -1,30 +1,26 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Dapper;
using NodaTime;
namespace PluralKit.Core
namespace PluralKit.Core;
public partial class ModelRepository
{
public partial class ModelRepository
{
public Task<IEnumerable<PKShardInfo>> GetShards() =>
_db.Execute(conn => conn.QueryAsync<PKShardInfo>("select * from shards order by id"));
public Task<IEnumerable<PKShardInfo>> GetShards() =>
_db.Execute(conn => conn.QueryAsync<PKShardInfo>("select * from shards order by id"));
public Task SetShardStatus(IPKConnection conn, int shard, PKShardInfo.ShardStatus status) =>
conn.ExecuteAsync(
"insert into shards (id, status) values (@Id, @Status) on conflict (id) do update set status = @Status",
new { Id = shard, Status = status });
public Task SetShardStatus(IPKConnection conn, int shard, PKShardInfo.ShardStatus status) =>
conn.ExecuteAsync(
"insert into shards (id, status) values (@Id, @Status) on conflict (id) do update set status = @Status",
new { Id = shard, Status = status });
public Task RegisterShardHeartbeat(IPKConnection conn, int shard, Duration ping) =>
conn.ExecuteAsync(
"insert into shards (id, last_heartbeat, ping) values (@Id, now(), @Ping) on conflict (id) do update set last_heartbeat = now(), ping = @Ping",
new { Id = shard, Ping = ping.TotalSeconds });
public Task RegisterShardHeartbeat(IPKConnection conn, int shard, Duration ping) =>
conn.ExecuteAsync(
"insert into shards (id, last_heartbeat, ping) values (@Id, now(), @Ping) on conflict (id) do update set last_heartbeat = now(), ping = @Ping",
new { Id = shard, Ping = ping.TotalSeconds });
public Task RegisterShardConnection(IPKConnection conn, int shard) =>
conn.ExecuteAsync(
"insert into shards (id, last_connection) values (@Id, now()) on conflict (id) do update set last_connection = now()",
new { Id = shard });
}
public Task RegisterShardConnection(IPKConnection conn, int shard) =>
conn.ExecuteAsync(
"insert into shards (id, last_connection) values (@Id, now()) on conflict (id) do update set last_connection = now()",
new { Id = shard });
}