2021-09-30 01:51:38 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Runtime.CompilerServices;
|
2021-08-27 15:03:47 +00:00
|
|
|
using System.Threading.Tasks;
|
2020-06-13 17:36:43 +00:00
|
|
|
|
2021-09-30 01:51:38 +00:00
|
|
|
using SqlKata;
|
|
|
|
|
2020-06-13 17:36:43 +00:00
|
|
|
namespace PluralKit.Core
|
|
|
|
{
|
|
|
|
public interface IDatabase
|
|
|
|
{
|
2020-06-13 17:54:16 +00:00
|
|
|
Task ApplyMigrations();
|
2020-06-13 17:36:43 +00:00
|
|
|
Task<IPKConnection> Obtain();
|
2021-09-30 01:51:38 +00:00
|
|
|
Task Execute(Func<IPKConnection, Task> func);
|
|
|
|
Task<T> Execute<T>(Func<IPKConnection, Task<T>> func);
|
|
|
|
IAsyncEnumerable<T> Execute<T>(Func<IPKConnection, IAsyncEnumerable<T>> func);
|
|
|
|
Task<int> ExecuteQuery(Query q, string extraSql = "", [CallerMemberName] string queryName = "");
|
2021-10-07 00:24:29 +00:00
|
|
|
Task<int> ExecuteQuery(IPKConnection? conn, Query q, string extraSql = "", [CallerMemberName] string queryName = "");
|
2021-09-30 01:51:38 +00:00
|
|
|
Task<T> QueryFirst<T>(Query q, string extraSql = "", [CallerMemberName] string queryName = "");
|
|
|
|
Task<T> QueryFirst<T>(IPKConnection? conn, Query q, string extraSql = "", [CallerMemberName] string queryName = "");
|
|
|
|
Task<IEnumerable<T>> Query<T>(Query q, [CallerMemberName] string queryName = "");
|
|
|
|
IAsyncEnumerable<T> QueryStream<T>(Query q, [CallerMemberName] string queryName = "");
|
|
|
|
Task<T> QuerySingleProcedure<T>(string queryName, object param);
|
|
|
|
Task<IEnumerable<T>> QueryProcedure<T>(string queryName, object param);
|
2020-06-13 17:36:43 +00:00
|
|
|
}
|
|
|
|
}
|