Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 4.9.0 [unreleased]

### Bug Fixes
1. [#408](https://github.com/influxdata/influxdb-client-csharp/issues/408): Conversion of double to string can result in a loss of precision

### Others
1. [#433](https://github.com/influxdata/influxdb-client-csharp/pull/433): Add `.NET 7.0` to supported `.NET` versions

Expand Down Expand Up @@ -712,7 +715,7 @@ This release also uses new version of InfluxDB OSS API definitions - [oss.yml](h

### Dependencies
[#283](https://github.com/influxdata/influxdb-client-csharp/pull/283): Update dependencies:

#### Build:
- RestSharp to 107.3.0
- CsvHelper to 27.2.1
Expand Down Expand Up @@ -811,7 +814,7 @@ This release introduces a support for new InfluxDB OSS API definitions - [oss.ym
- `Check` <- `CheckDiscriminator` <- `CheckBase`
- `NotificationEndpoint` <- `NotificationEndpointDiscriminator` <- `NotificationEndpointBase`
- `NotificationRule` <- `NotificationRuleDiscriminator` <- `NNotificationRuleBase`
- Flux AST literals extends the AST `Expression` object
- Flux AST literals extends the AST `Expression` object

### Deprecates
- `AuthorizationsApi.CreateAuthorizationAsync(Authorization)`: instead use `AuthorizationsApi.CreateAuthorizationAsync(AuthorizationPostRequest)`
Expand All @@ -831,7 +834,7 @@ This release introduces a support for new InfluxDB OSS API definitions - [oss.ym
- Microsoft.Extensions.ObjectPool to 5.0.7

### Documentation
1. [#213](https://github.com/influxdata/influxdb-client-csharp/pull/213): API documentation is deploy to [GitHub Pages](https://influxdata.github.io/influxdb-client-csharp/api/InfluxDB.Client.html)
1. [#213](https://github.com/influxdata/influxdb-client-csharp/pull/213): API documentation is deploy to [GitHub Pages](https://influxdata.github.io/influxdb-client-csharp/api/InfluxDB.Client.html)

## 1.19.0 [2021-06-04]

Expand Down Expand Up @@ -951,7 +954,7 @@ This release introduces a support for new InfluxDB OSS API definitions - [oss.ym
1. [#102](https://github.com/influxdata/influxdb-client-csharp/pull/102): Added WriteApiAsync for asynchronous write without batching

### Bug Fixes
1. [#106](https://github.com/influxdata/influxdb-client-csharp/pull/106): Fixed serialization of `\n`, `\r` and `\t` to Line Protocol, `=` is valid sign for measurement name
1. [#106](https://github.com/influxdata/influxdb-client-csharp/pull/106): Fixed serialization of `\n`, `\r` and `\t` to Line Protocol, `=` is valid sign for measurement name
1. [#108](https://github.com/influxdata/influxdb-client-csharp/issues/108): Replaced useless .ContinueWith in Api by direct call

## 1.9.0 [2020-06-19]
Expand All @@ -967,8 +970,8 @@ This release introduces a support for new InfluxDB OSS API definitions - [oss.ym
1. [#104](https://github.com/influxdata/influxdb-client-csharp/pull/104): Upgraded InfluxDB 1.7 to 1.8

### Bug Fixes
1. [#100](https://github.com/influxdata/influxdb-client-csharp/pull/100): Thread-safety disposing of clients
1. [#101](https://github.com/influxdata/influxdb-client-csharp/pull/101/): Use Trace output when disposing WriteApi
1. [#100](https://github.com/influxdata/influxdb-client-csharp/pull/100): Thread-safety disposing of clients
1. [#101](https://github.com/influxdata/influxdb-client-csharp/pull/101/): Use Trace output when disposing WriteApi

## 1.8.0 [2020-05-15]

Expand Down Expand Up @@ -1064,7 +1067,7 @@ This release introduces a support for new InfluxDB OSS API definitions - [oss.ym
## 1.0.0 [2019-08-23]

### Features
1. [#29](https://github.com/influxdata/influxdb-client-csharp/issues/29): Added support for gzip compression of query response and write body
1. [#29](https://github.com/influxdata/influxdb-client-csharp/issues/29): Added support for gzip compression of query response and write body

### Bug Fixes
1. [#27](https://github.com/influxdata/influxdb-client-csharp/issues/27): The org parameter takes either the ID or Name interchangeably
Expand Down
6 changes: 4 additions & 2 deletions Client.Test/MeasurementMapperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public void ColumnWithoutName()

var lineProtocol = _mapper.ToPoint(poco, WritePrecision.S).ToLineProtocol();

Assert.AreEqual("poco,tag=tag\\ val value=15.444,ValueWithEmptyName=25,ValueWithoutDefaultName=20i 864000",
Assert.AreEqual(
"poco,tag=tag\\ val value=15.444000000000001,ValueWithEmptyName=25,ValueWithoutDefaultName=20i 864000",
lineProtocol);
}

Expand Down Expand Up @@ -111,7 +112,8 @@ public void MeasurementProperty()

var lineProtocol = _mapper.ToPoint(poco, WritePrecision.S).ToLineProtocol();

Assert.AreEqual("poco,tag=tag\\ val value=15.444,ValueWithEmptyName=25,ValueWithoutDefaultName=20i 864000",
Assert.AreEqual(
"poco,tag=tag\\ val value=15.444000000000001,ValueWithEmptyName=25,ValueWithoutDefaultName=20i 864000",
lineProtocol);
}

Expand Down
19 changes: 18 additions & 1 deletion Client.Test/PointDataTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,24 @@ public void FieldTypes()

var expected =
"h2o,location=europe boolean=false,byte=9i,decimal=25.6,double=250.69,float=35,integer=7i,long=1i," +
"point=13.3,sbyte=12i,short=8i,string=\"string value\",uint=11u,ulong=10u,ushort=13u";
"point=13.300000000000001,sbyte=12i,short=8i,string=\"string value\",uint=11u,ulong=10u,ushort=13u";

Assert.AreEqual(expected, point.ToLineProtocol());
}

[Test]
public void DoubleFormat()
{
var point = PointData.Measurement("sensor")
.Field("double", 250.69D)
.Field("double15", 15.333333333333333D)
.Field("double16", 16.3333333333333333D)
.Field("double17", 17.33333333333333333D)
.Field("example", 459.29587181322927);

var expected =
"sensor double=250.69,double15=15.333333333333332,double16=16.333333333333332," +
"double17=17.333333333333332,example=459.29587181322927";

Assert.AreEqual(expected, point.ToLineProtocol());
}
Expand Down
7 changes: 6 additions & 1 deletion Client/Writes/PointData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,15 @@ private bool AppendFields(StringBuilder sb)
EscapeKey(sb, key);
sb.Append('=');

if (value is double || value is float)
if (value is float)
{
sb.Append(((IConvertible)value).ToString(CultureInfo.InvariantCulture));
}
else if (value is double)
{
var valueStr = ((double)value).ToString("G17", CultureInfo.InvariantCulture);
sb.Append((IConvertible)valueStr);
}
else if (value is uint || value is ulong || value is ushort)
{
sb.Append(((IConvertible)value).ToString(CultureInfo.InvariantCulture));
Expand Down