Skip to content

Commit

Permalink
Feat query structured (#51)
Browse files Browse the repository at this point in the history
* feat: QueryPoints base

* feat: guess types on no metadata

* docs: PointData method comments

* refactor: check if measurement before metadata

* style: comment, lint

* feat: PointDataValues, Mutable PointData

* fix: renamed methods

* feat: PointDataValues QueryPoints

* feat: use only reference types in PointData

* feat: fromValues

* refactor: removed unused methods, added comments

* fix: code style

* fix: code style

* fix: lang version

* docs: use 7.0 dotnet for codeQL

* Revert "fix: lang version"

This reverts commit 4d126c4.

* docs: use 7.0 dotnet for codeQL

---------

Co-authored-by: Sciator <[email protected]>
  • Loading branch information
bednar and Sciator authored Sep 21, 2023
1 parent 8fa479f commit 51594ad
Show file tree
Hide file tree
Showing 15 changed files with 1,165 additions and 861 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
7.0.x
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/.idea/
/.vscode/
/.vs/

# Build results
[Dd]ebug/
Expand Down
4 changes: 2 additions & 2 deletions Client.Test.Integration/QueryWriteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public async Task WriteDontFailForEmptyData()
Token = _token
});

await client.WritePointAsync(PointData.Measurement("cpu").AddTag("tag", "c"));
await client.WritePointAsync(PointData.Measurement("cpu").SetTag("tag", "c"));
}

[Test]
Expand All @@ -112,7 +112,7 @@ public async Task CanDisableCertificateValidation()
DisableServerCertificateValidation = true
});

await client.WritePointAsync(PointData.Measurement("cpu").AddTag("tag", "c"));
await client.WritePointAsync(PointData.Measurement("cpu").SetTag("tag", "c"));
}


Expand Down
2 changes: 1 addition & 1 deletion Client.Test/InfluxDBClientQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void AlreadyDisposed()
});

Assert.That(ae, Is.Not.Null);
Assert.That(ae.Message, Is.EqualTo("Cannot access a disposed object.\nObject name: 'InfluxDBClient'."));
Assert.That(ae.Message, Is.EqualTo($"Cannot access a disposed object.{Environment.NewLine}Object name: 'InfluxDBClient'."));
}

[Test]
Expand Down
8 changes: 4 additions & 4 deletions Client.Test/InfluxDBClientWriteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async Task BodyPoint()

_client = new InfluxDBClient(MockServerUrl, organization: "org", database: "database");

await _client.WritePointAsync(PointData.Measurement("cpu").AddTag("tag", "c").AddField("field", 1));
await _client.WritePointAsync(PointData.Measurement("cpu").SetTag("tag", "c").SetField("field", 1));

var requests = MockServer.LogEntries.ToList();
Assert.That(requests[0].RequestMessage.BodyData?.BodyAsString, Is.EqualTo("cpu,tag=c field=1i"));
Expand Down Expand Up @@ -124,7 +124,7 @@ public void AlreadyDisposed()
});

Assert.That(ae, Is.Not.Null);
Assert.That(ae.Message, Is.EqualTo("Cannot access a disposed object.\nObject name: 'InfluxDBClient'."));
Assert.That(ae.Message, Is.EqualTo($"Cannot access a disposed object.{Environment.NewLine}Object name: 'InfluxDBClient'."));
}

[Test]
Expand Down Expand Up @@ -230,8 +230,8 @@ public async Task PrecisionBody()
.RespondWith(Response.Create().WithStatusCode(204));

var point = PointData.Measurement("h2o")
.AddTag("location", "europe")
.AddField("level", 2)
.SetTag("location", "europe")
.SetField("level", 2)
.SetTimestamp(123_000_000_000L);

await _client.WritePointAsync(point, precision: WritePrecision.S);
Expand Down
234 changes: 0 additions & 234 deletions Client.Test/Write/PointDataBuilderTest.cs

This file was deleted.

Loading

0 comments on commit 51594ad

Please sign in to comment.