From 75f5f34418f9c96ec6def7788fd22974fb281839 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 9 Nov 2024 14:05:38 +0200 Subject: [PATCH 1/2] Code cleanup and fixing compilation warnings related to nullability --- RqliteDotnet/IRqliteClient.cs | 2 +- RqliteDotnet/IRqliteOrmClient.cs | 18 ++++++++++++++++++ RqliteDotnet/RqliteClient.cs | 2 +- RqliteDotnet/RqliteOrmClient.cs | 22 +--------------------- 4 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 RqliteDotnet/IRqliteOrmClient.cs 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..15a2e82 100644 --- a/RqliteDotnet/RqliteClient.cs +++ b/RqliteDotnet/RqliteClient.cs @@ -33,7 +33,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); From 4a8d455ef17959c06c13c09476f725d9fcdada3a Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 9 Nov 2024 14:07:20 +0200 Subject: [PATCH 2/2] Remove unused imports --- RqliteDotnet/RqliteClient.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/RqliteDotnet/RqliteClient.cs b/RqliteDotnet/RqliteClient.cs index 15a2e82..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;