2024-06-23 18:15:32 -04:00
|
|
|
|
using System.Data.Common;
|
2024-09-05 23:03:43 -04:00
|
|
|
|
using FruityFoundation.Base.Structures;
|
2024-06-23 18:15:32 -04:00
|
|
|
|
|
|
|
|
|
namespace FruityFoundation.DataAccess.Abstractions;
|
|
|
|
|
|
|
|
|
|
// ReSharper disable once UnusedTypeParameter
|
|
|
|
|
public interface IDatabaseConnection<out TConnectionType> where TConnectionType : ConnectionType
|
|
|
|
|
{
|
|
|
|
|
public Task<IEnumerable<T>> Query<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
|
|
|
|
|
public IAsyncEnumerable<T> QueryUnbuffered<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
|
|
|
|
|
public Task<T> QuerySingle<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
|
2024-09-05 23:03:43 -04:00
|
|
|
|
public Task<Maybe<T>> TryQueryFirst<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
|
2024-06-23 18:15:32 -04:00
|
|
|
|
public Task Execute(string sql, object? param = null, CancellationToken cancellationToken = default);
|
|
|
|
|
public Task<T?> ExecuteScalar<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
|
|
|
|
|
public Task<DbDataReader> ExecuteReader(string sql, object? param = null, CancellationToken cancellationToken = default);
|
|
|
|
|
}
|