Skip to content

Instantly share code, notes, and snippets.

@seanfisher
Last active November 7, 2017 22:07
Show Gist options
  • Save seanfisher/cb51e149575da077103700a088e9394e to your computer and use it in GitHub Desktop.
Save seanfisher/cb51e149575da077103700a088e9394e to your computer and use it in GitHub Desktop.
Interface extracted from the source code of SQLiteAsyncConnection from SQLite.Net-PCL.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using SQLite.Net;
using SQLite.Net.Async;
namespace Seanfisher.Gists
{
/// <summary>
/// Interface extracted from the source code of SQLiteAsyncConnection.
/// Original class at https://github.com/oysteinkrog/SQLite.Net-PCL/blob/master/src/SQLite.Net.Async/SQLiteAsyncConnection.cs
/// </summary>
public interface ISQLiteAsyncConnection
{
Task<CreateTablesResult> CreateTableAsync<T>(CancellationToken cancellationToken = default(CancellationToken))
where T : class;
Task<CreateTablesResult> CreateTablesAsync<T, T2>(CancellationToken cancellationToken = default(CancellationToken))
where T : class
where T2 : class;
Task<CreateTablesResult> CreateTablesAsync<T, T2, T3>(CancellationToken cancellationToken = default(CancellationToken))
where T : class
where T2 : class
where T3 : class;
Task<CreateTablesResult> CreateTablesAsync<T, T2, T3, T4>(CancellationToken cancellationToken = default(CancellationToken))
where T : class
where T2 : class
where T3 : class
where T4 : class;
Task<CreateTablesResult> CreateTablesAsync<T, T2, T3, T4, T5>(CancellationToken cancellationToken = default(CancellationToken))
where T : class
where T2 : class
where T3 : class
where T4 : class
where T5 : class;
Task<CreateTablesResult> CreateTablesAsync(params Type[] types);
Task<CreateTablesResult> CreateTablesAsync(CancellationToken cancellationToken = default(CancellationToken), params Type[] types);
Task<int> DropTableAsync<T>(CancellationToken cancellationToken = default(CancellationToken))
where T : class;
Task<int> DropTableAsync(Type t, CancellationToken cancellationToken = default(CancellationToken));
Task<int> InsertAsync(object item, CancellationToken cancellationToken = default(CancellationToken));
Task<int> UpdateAsync(object item, CancellationToken cancellationToken = default(CancellationToken));
Task<int> InsertOrIgnoreAsync(object item);
Task<int> InsertOrIgnoreAllAsync(IEnumerable objects, CancellationToken cancellationToken = default(CancellationToken));
Task<int> InsertOrReplaceAsync(object item, CancellationToken cancellationToken = default(CancellationToken));
Task<int> DeleteAsync(object item, CancellationToken cancellationToken = default(CancellationToken));
Task<int> DeleteAllAsync<T>(CancellationToken cancellationToken = default(CancellationToken));
Task<int> DeleteAllAsync(Type t, CancellationToken cancellationToken = default(CancellationToken));
Task<int> DeleteAsync<T>(object pk, CancellationToken cancellationToken = default(CancellationToken));
Task<T> GetAsync<T>(object pk, CancellationToken cancellationToken = default(CancellationToken))
where T : class;
Task<T> FindAsync<T>(object pk, CancellationToken cancellationToken = default(CancellationToken))
where T : class;
Task<T> GetAsync<T>(Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
where T : class;
Task<T> FindAsync<T>(Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
where T : class;
Task<int> ExecuteAsync(string query, params object[] args);
Task<int> ExecuteAsync(CancellationToken cancellationToken, string query, params object[] args);
Task<int> InsertAllAsync(IEnumerable items, CancellationToken cancellationToken = default(CancellationToken));
Task<int> InsertOrReplaceAllAsync(IEnumerable items, CancellationToken cancellationToken = default(CancellationToken));
Task<int> UpdateAllAsync(IEnumerable items, CancellationToken cancellationToken = default(CancellationToken));
Task RunInTransactionAsync(Action<SQLiteAsyncConnection> action, CancellationToken cancellationToken = default(CancellationToken));
Task RunInTransactionAsync(Action<SQLiteConnection> action, CancellationToken cancellationToken = default(CancellationToken));
AsyncTableQuery<T> Table<T>()
where T : class;
Task<T> ExecuteScalarAsync<T>(string sql, params object[] args);
Task<T> ExecuteScalarAsync<T>(CancellationToken cancellationToken, string sql, params object[] args);
Task ExecuteNonQueryAsync(string sql, params object[] args);
Task ExecuteNonQueryAsync(CancellationToken cancellationToken, string sql, params object[] args);
Task<List<T>> QueryAsync<T>(string sql, params object[] args)
where T : class;
Task<List<T>> QueryAsync<T>(CancellationToken cancellationToken, string sql, params object[] args)
where T : class;
Task<TableMapping> GetMappingAsync<T>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment