mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: upgrade to .NET 6, refactor everything
This commit is contained in:
parent
d28e99ba43
commit
1918c56937
314 changed files with 27954 additions and 27966 deletions
|
|
@ -1,33 +1,32 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dapper;
|
||||
|
||||
using SqlKata;
|
||||
namespace PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Core
|
||||
public partial class ModelRepository
|
||||
{
|
||||
public partial class ModelRepository
|
||||
public async Task UpdateStats()
|
||||
{
|
||||
public async Task UpdateStats()
|
||||
{
|
||||
await _db.Execute(conn => conn.ExecuteAsync("update info set system_count = (select count(*) from systems)"));
|
||||
await _db.Execute(conn => conn.ExecuteAsync("update info set member_count = (select count(*) from members)"));
|
||||
await _db.Execute(conn => conn.ExecuteAsync("update info set group_count = (select count(*) from groups)"));
|
||||
await _db.Execute(conn => conn.ExecuteAsync("update info set switch_count = (select count(*) from switches)"));
|
||||
await _db.Execute(conn => conn.ExecuteAsync("update info set message_count = (select count(*) from messages)"));
|
||||
}
|
||||
await _db.Execute(conn =>
|
||||
conn.ExecuteAsync("update info set system_count = (select count(*) from systems)"));
|
||||
await _db.Execute(conn =>
|
||||
conn.ExecuteAsync("update info set member_count = (select count(*) from members)"));
|
||||
await _db.Execute(conn =>
|
||||
conn.ExecuteAsync("update info set group_count = (select count(*) from groups)"));
|
||||
await _db.Execute(conn =>
|
||||
conn.ExecuteAsync("update info set switch_count = (select count(*) from switches)"));
|
||||
await _db.Execute(conn =>
|
||||
conn.ExecuteAsync("update info set message_count = (select count(*) from messages)"));
|
||||
}
|
||||
|
||||
public Task<Counts> GetStats()
|
||||
=> _db.Execute(conn => conn.QuerySingleAsync<Counts>("select * from info"));
|
||||
public Task<Counts> GetStats()
|
||||
=> _db.Execute(conn => conn.QuerySingleAsync<Counts>("select * from info"));
|
||||
|
||||
public class Counts
|
||||
{
|
||||
public int SystemCount { get; }
|
||||
public int MemberCount { get; }
|
||||
public int GroupCount { get; }
|
||||
public int SwitchCount { get; }
|
||||
public int MessageCount { get; }
|
||||
}
|
||||
public class Counts
|
||||
{
|
||||
public int SystemCount { get; }
|
||||
public int MemberCount { get; }
|
||||
public int GroupCount { get; }
|
||||
public int SwitchCount { get; }
|
||||
public int MessageCount { get; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue