Skip to content

Commit

Permalink
feat: add downsampling skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar committed Sep 25, 2023
1 parent 53373da commit 52dc984
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Client.Test.Integration/QueryWriteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task QueryWrite()
var points = await client.QueryPoints(sql).ToListAsync();
Assert.That(points, Has.Count.EqualTo(1));
Assert.That(points.First().GetField("value"), Is.EqualTo(123.0));

points = await client.QueryPoints($"SELECT * FROM {measurement} where \"testId\" = {testId}").ToListAsync();
Assert.That(points, Has.Count.EqualTo(1));
Assert.That(points.First().GetField("value"), Is.EqualTo(123.0));
Expand Down
23 changes: 23 additions & 0 deletions Examples/Downsampling/Downsampling.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<AssemblyName>InfluxDB3.Examples.Downsampling</AssemblyName>
<RootNamespace>InfluxDB3.Examples.Downsampling</RootNamespace>

<AssemblyOriginatorKeyFile>../../Keys/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

<OutputType>Exe</OutputType>
<StartupObject>InfluxDB3.Examples.Downsampling.DownsamplingExample</StartupObject>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Client\Client.csproj" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions Examples/Downsampling/DownsamplingExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Threading.Tasks;
using InfluxDB3.Client;

namespace InfluxDB3.Examples.Downsampling;

public class DownsamplingExample
{
static async Task Main(string[] args)

Check warning on line 8 in Examples/Downsampling/DownsamplingExample.cs

View workflow job for this annotation

GitHub Actions / CodeQL-Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 8 in Examples/Downsampling/DownsamplingExample.cs

View workflow job for this annotation

GitHub Actions / CodeQL-Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
const string host = "https://us-east-1-1.aws.cloud2.influxdata.com";
const string token = "my-token";
const string database = "my-database";

using var client = new InfluxDBClient(host: host, token: token, database: database);
}
}
1 change: 0 additions & 1 deletion Examples/IOx/IOxExample.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using InfluxDB3.Client;
using InfluxDB3.Client.Query;
Expand Down
3 changes: 1 addition & 2 deletions Examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Examples

## Basic

- [IOxExample](IOx/IOxExample.cs) - How to use write and query data from InfluxDB IOx
- [Downsampling](Downsampling/Downsampling.cs) - How to use queries to structure data for downsampling
7 changes: 7 additions & 0 deletions InfluxDB3.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{EF
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples.IOx", "Examples\IOx\Examples.IOx.csproj", "{B2DA69ED-C21D-4531-A32A-E537DC511785}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Downsampling", "Examples\Downsampling\Downsampling.csproj", "{44C91C8C-B194-48CE-A5B1-763457F118F4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -38,8 +40,13 @@ Global
{B2DA69ED-C21D-4531-A32A-E537DC511785}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2DA69ED-C21D-4531-A32A-E537DC511785}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2DA69ED-C21D-4531-A32A-E537DC511785}.Release|Any CPU.Build.0 = Release|Any CPU
{44C91C8C-B194-48CE-A5B1-763457F118F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44C91C8C-B194-48CE-A5B1-763457F118F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44C91C8C-B194-48CE-A5B1-763457F118F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44C91C8C-B194-48CE-A5B1-763457F118F4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B2DA69ED-C21D-4531-A32A-E537DC511785} = {EFBEAA10-411F-4BDB-A96B-B54632FAE99D}
{44C91C8C-B194-48CE-A5B1-763457F118F4} = {EFBEAA10-411F-4BDB-A96B-B54632FAE99D}
EndGlobalSection
EndGlobal

0 comments on commit 52dc984

Please sign in to comment.