-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Extend ORM client to handle parameterized queries and adapt for dependency injection * Adding unit tests and fixing a formatting error in the QueryParameter classes * Extracting IRqliteClient to a separate file * Removing nullable return type from HttpClientExtensions.SendTyped --------- Co-authored-by: Jonatan Olofsson <[email protected]>
- Loading branch information
1 parent
1c7e5c6
commit d7b5009
Showing
8 changed files
with
219 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
namespace RqliteDotnet; | ||
|
||
[Flags] | ||
public enum DbFlag | ||
{ | ||
Timings = 1, | ||
Transaction | ||
Transaction = 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using RqliteDotnet.Dto; | ||
|
||
namespace RqliteDotnet; | ||
|
||
public interface IRqliteClient | ||
{ | ||
/// <summary> | ||
/// Ping Rqlite instance | ||
/// </summary> | ||
/// <returns>String containining Rqlite version</returns> | ||
Task<string> Ping(); | ||
|
||
/// <summary> | ||
/// Query DB and return result | ||
/// </summary> | ||
/// <param name="query"></param> | ||
Task<QueryResults> Query(string query); | ||
|
||
/// <summary> | ||
/// Execute command and return result | ||
/// </summary> | ||
Task<ExecuteResults> Execute(string command); | ||
|
||
/// <summary> | ||
/// Execute one or several commands and return result | ||
/// </summary> | ||
/// <param name="commands">Commands to execute</param> | ||
/// <param name="flags">Command flags, e.g. whether to use transaction</param> | ||
/// <returns></returns> | ||
Task<ExecuteResults> Execute(IEnumerable<string> commands, DbFlag? flags); | ||
|
||
/// <summary> | ||
/// Execute one or several commands and return result | ||
/// </summary> | ||
/// <param name="commands">Commands to execute</param> | ||
/// <param name="flags">Command flags, e.g. whether to use transaction</param> | ||
/// <returns></returns> | ||
Task<ExecuteResults> ExecuteParams<T>(IEnumerable<(string, T[])> commands, DbFlag? flags) where T : QueryParameter; | ||
|
||
/// <summary> | ||
/// Query DB using parametrized statement | ||
/// </summary> | ||
/// <param name="query"></param> | ||
/// <param name="qps"></param> | ||
/// <typeparam name="T"></typeparam> | ||
/// <returns></returns> | ||
Task<QueryResults> QueryParams<T>(string query, params T[] qps) where T: QueryParameter; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters