mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 13:57:54 +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,28 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using SqlKata;
|
||||
|
||||
namespace PluralKit.Core
|
||||
namespace PluralKit.Core;
|
||||
|
||||
internal class QueryPatchWrapper
|
||||
{
|
||||
internal class QueryPatchWrapper
|
||||
private readonly Dictionary<string, object> _dict = new();
|
||||
|
||||
public QueryPatchWrapper With<T>(string columnName, Partial<T> partialValue)
|
||||
{
|
||||
private Dictionary<string, object> _dict = new();
|
||||
if (partialValue.IsPresent)
|
||||
_dict.Add(columnName, partialValue);
|
||||
|
||||
public QueryPatchWrapper With<T>(string columnName, Partial<T> partialValue)
|
||||
{
|
||||
if (partialValue.IsPresent)
|
||||
_dict.Add(columnName, partialValue);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query ToQuery(Query q) => q.AsUpdate(_dict);
|
||||
return this;
|
||||
}
|
||||
|
||||
internal static class SqlKataExtensions
|
||||
{
|
||||
internal static Query ApplyPatch(this Query query, Func<QueryPatchWrapper, QueryPatchWrapper> func)
|
||||
=> func(new QueryPatchWrapper()).ToQuery(query);
|
||||
}
|
||||
public Query ToQuery(Query q) => q.AsUpdate(_dict);
|
||||
}
|
||||
|
||||
internal static class SqlKataExtensions
|
||||
{
|
||||
internal static Query ApplyPatch(this Query query, Func<QueryPatchWrapper, QueryPatchWrapper> func)
|
||||
=> func(new QueryPatchWrapper()).ToQuery(query);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue