diff --git a/RqliteDotnet/IRqliteClient.cs b/RqliteDotnet/IRqliteClient.cs index a885055..53330b7 100644 --- a/RqliteDotnet/IRqliteClient.cs +++ b/RqliteDotnet/IRqliteClient.cs @@ -17,7 +17,7 @@ public interface IRqliteClient /// /// /// - Task Query(string query, ReadLevel level, CancellationToken cancellationToken); + Task Query(string query, ReadLevel level, CancellationToken cancellationToken); /// /// Execute command and return result diff --git a/RqliteDotnet/IRqliteOrmClient.cs b/RqliteDotnet/IRqliteOrmClient.cs new file mode 100644 index 0000000..dafe198 --- /dev/null +++ b/RqliteDotnet/IRqliteOrmClient.cs @@ -0,0 +1,18 @@ +using RqliteDotnet.Dto; + +namespace RqliteDotnet; + +public interface IRqliteOrmClient : IRqliteClient +{ + /// + /// Query Rqlite DB and return result as an instance of T + /// + /// Query to execute + /// Type of result object + /// + Task> Query(string query) where T: new(); + + Task> QueryParams(string query, CancellationToken cancellationToken, params T[] qps) + where T: QueryParameter + where U : new(); +} \ No newline at end of file diff --git a/RqliteDotnet/RqliteClient.cs b/RqliteDotnet/RqliteClient.cs index 218cac1..d69745a 100644 --- a/RqliteDotnet/RqliteClient.cs +++ b/RqliteDotnet/RqliteClient.cs @@ -1,12 +1,6 @@ using RqliteDotnet.Dto; -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Net.Http; using System.Text; using System.Text.Json; -using System.Threading.Tasks; namespace RqliteDotnet; @@ -33,7 +27,7 @@ public async Task Ping(CancellationToken cancellationToken = default) } /// - public async Task Query(string query, ReadLevel level = ReadLevel.Default, CancellationToken cancellationToken = default) + public async Task Query(string query, ReadLevel level = ReadLevel.Default, CancellationToken cancellationToken = default) { var url = UrlBuilder.Build("/db/query?timings", query, level); diff --git a/RqliteDotnet/RqliteOrmClient.cs b/RqliteDotnet/RqliteOrmClient.cs index 4cee832..e792417 100644 --- a/RqliteDotnet/RqliteOrmClient.cs +++ b/RqliteDotnet/RqliteOrmClient.cs @@ -3,33 +3,13 @@ namespace RqliteDotnet; -public interface IRqliteOrmClient : IRqliteClient -{ - /// - /// Query Rqlite DB and return result as an instance of T - /// - /// Query to execute - /// Type of result object - /// - Task> Query(string query) where T: new(); - - Task> QueryParams(string query, CancellationToken cancellationToken, params T[] qps) - where T: QueryParameter - where U : new(); -} - public class RqliteOrmClient : RqliteClient, IRqliteOrmClient { public RqliteOrmClient(HttpClient client) : base(client) { } public RqliteOrmClient(string uri, HttpClient? client = null) : base(uri, client) {} - /// - /// Query Rqlite DB and return result as an instance of T - /// - /// Query to execute - /// Type of result object - /// + /// public async Task> Query(string query) where T : new() { var response = await Query(query);