PluralKit/PluralKit.Core/Models/ModelQueryExt.cs

14 lines
422 B
C#
Raw Normal View History

2020-06-13 11:58:27 +00:00
using System;
using System.Data;
using System.Threading.Tasks;
using Dapper;
namespace PluralKit.Core
{
public static class ModelQueryExt
{
public static Task<GuildConfig> QueryOrInsertGuildConfig(this IDbConnection conn, ulong guild) =>
conn.QueryFirstOrDefaultAsync<GuildConfig>("insert into servers (id) values (@Guild) on conflict do nothing returning *", new {Guild = guild});
}
}