Add Elastic-bound logging of (almost) all database update events

This commit is contained in:
Ske
2020-08-27 21:28:36 +02:00
parent 8d27148bdf
commit 9955dc29f9
11 changed files with 182 additions and 45 deletions

View File

@@ -10,10 +10,11 @@ using Newtonsoft.Json;
namespace PluralKit.Core
{
[JsonConverter(typeof(PartialConverter))]
public struct Partial<T>: IEnumerable<T>
public struct Partial<T>: IEnumerable<T>, IPartial
{
public bool IsPresent { get; }
public T Value { get; }
public object? RawValue => Value;
private Partial(bool isPresent, T value)
{
@@ -34,6 +35,12 @@ namespace PluralKit.Core
public static implicit operator Partial<T>(T val) => Present(val);
}
public interface IPartial
{
public bool IsPresent { get; }
public object? RawValue { get; }
}
public class PartialConverter: JsonConverter
{
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue,