2020-06-13 16:31:20 +00:00
|
|
|
using System.Data;
|
|
|
|
|
|
|
|
using Npgsql;
|
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
namespace PluralKit.Core;
|
|
|
|
|
|
|
|
public interface IPKConnection: IDbConnection, IAsyncDisposable
|
2020-06-13 16:31:20 +00:00
|
|
|
{
|
2021-11-27 02:10:56 +00:00
|
|
|
public Guid ConnectionId { get; }
|
|
|
|
|
|
|
|
public Task OpenAsync(CancellationToken cancellationToken = default);
|
|
|
|
public Task CloseAsync();
|
2021-08-27 15:03:47 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public Task ChangeDatabaseAsync(string databaseName, CancellationToken ct = default);
|
2020-06-13 16:31:20 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public ValueTask<IPKTransaction> BeginTransactionAsync(CancellationToken ct = default) =>
|
|
|
|
BeginTransactionAsync(IsolationLevel.Unspecified, ct);
|
2021-08-27 15:03:47 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public ValueTask<IPKTransaction> BeginTransactionAsync(IsolationLevel level, CancellationToken ct = default);
|
2021-08-27 15:03:47 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public NpgsqlBinaryImporter BeginBinaryImport(string copyFromCommand);
|
|
|
|
public NpgsqlBinaryExporter BeginBinaryExport(string copyToCommand);
|
2021-08-27 15:03:47 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
[Obsolete] new void Open();
|
|
|
|
[Obsolete] new void Close();
|
2020-06-13 16:31:20 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
[Obsolete] new IDbTransaction BeginTransaction();
|
|
|
|
[Obsolete] new IDbTransaction BeginTransaction(IsolationLevel il);
|
2020-06-13 16:31:20 +00:00
|
|
|
}
|