Skip to content

Commit 0269944

Browse files
committed
Add XML docs and other minor fixes
1 parent 8906d8f commit 0269944

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

RqliteDotnet/RqliteClient.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ public RqliteClient(string uri, HttpClient? client = null)
1414
{
1515
_httpClient = client ?? new HttpClient(){ BaseAddress = new Uri(uri) };
1616
}
17-
17+
18+
/// <summary>
19+
/// Ping Rqlite instance
20+
/// </summary>
21+
/// <returns>String containining Rqlite version</returns>
1822
public async Task<string> Ping()
1923
{
2024
var x = await _httpClient.GetAsync("/status");
2125

2226
return x.Headers.GetValues("X-Rqlite-Version").FirstOrDefault()!;
2327
}
24-
28+
29+
/// <summary>
30+
/// Query DB and return result
31+
/// </summary>
32+
/// <param name="query"></param>
2533
public async Task<QueryResults> Query(string query)
2634
{
2735
var data = "&q="+Uri.EscapeDataString(query);
@@ -33,7 +41,10 @@ public async Task<QueryResults> Query(string query)
3341
var result = JsonSerializer.Deserialize<QueryResults>(str, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
3442
return result;
3543
}
36-
44+
45+
/// <summary>
46+
/// Execute command and return result
47+
/// </summary>
3748
public async Task<ExecuteResults> Execute(string command)
3849
{
3950
var request = new HttpRequestMessage(HttpMethod.Post, "/db/execute?timings");
@@ -43,6 +54,12 @@ public async Task<ExecuteResults> Execute(string command)
4354
return result;
4455
}
4556

57+
/// <summary>
58+
/// Execute one or several commands and return result
59+
/// </summary>
60+
/// <param name="commands">Commands to execute</param>
61+
/// <param name="flags">Command flags, e.g. whether to use transaction</param>
62+
/// <returns></returns>
4663
public async Task<ExecuteResults> Execute(IEnumerable<string> commands, DbFlag? flags)
4764
{
4865
var parameters = GetParameters(flags);
@@ -55,6 +72,13 @@ public async Task<ExecuteResults> Execute(IEnumerable<string> commands, DbFlag?
5572
return result;
5673
}
5774

75+
/// <summary>
76+
/// Query DB using parametrized statement
77+
/// </summary>
78+
/// <param name="query"></param>
79+
/// <param name="qps"></param>
80+
/// <typeparam name="T"></typeparam>
81+
/// <returns></returns>
5882
public async Task<QueryResults> QueryParams<T>(string query, params T[] qps) where T: QueryParameter
5983
{
6084
var request = new HttpRequestMessage(HttpMethod.Post, "/db/query?timings");

RqliteDotnet/RqliteDotnet.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>RqliteDotnet</id>
5-
<version>1.0.1</version>
5+
<version>1.0.2</version>
66
<authors>arthrp, otoolep et al.</authors>
77
<description>Client for Rqlite - lightweight distributed database</description>
88
<language>en-US</language>

RqliteDotnet/RqliteOrmClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class RqliteOrmClient : RqliteClient
77
public RqliteOrmClient(string uri, HttpClient? client = null) : base(uri, client) {}
88

99
/// <summary>
10-
/// Query Rqlite and return result as an instance of T
10+
/// Query Rqlite DB and return result as an instance of T
1111
/// </summary>
1212
/// <param name="query">Query to execute</param>
1313
/// <typeparam name="T">Type of result object</typeparam>
@@ -30,9 +30,9 @@ public RqliteOrmClient(string uri, HttpClient? client = null) : base(uri, client
3030
foreach (var prop in typeof(T).GetProperties())
3131
{
3232
var index = res.Columns.FindIndex(c => c.ToLower() == prop.Name.ToLower());
33-
var x = GetValue(res.Types[index], res.Values[i][index]);
33+
var val = GetValue(res.Types[index], res.Values[i][index]);
3434

35-
prop.SetValue(dto, x);
35+
prop.SetValue(dto, val);
3636
}
3737

3838
list.Add(dto);

0 commit comments

Comments
 (0)