influxdb-client 2.10.0.pre.7445 → 3.0.0.pre.7554

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5078b8c7c980f7a6462ed86670292359d3cf55f5ccfe9997cbf7030ff8fe697
4
- data.tar.gz: 2bd59a68d4a87482fac43c57c1b1c5f0f138f7cab02177e8cbb819f21d164e05
3
+ metadata.gz: e4b2dc7e810dddec2388e1f1241287aab923d6605209fed449614c1bda7318af
4
+ data.tar.gz: d9c941fa890969401a179d439607a1b7434ed128ed6ce5916abb395944e674d9
5
5
  SHA512:
6
- metadata.gz: 1858b8882d2f96a12f1c20e1df59b2bdac9d2fff62629c0edc6b5c676b45864a4a677cde7aa70fd6829b42158e900aa795aba78725f468fa26b7dd4284aca472
7
- data.tar.gz: a4683d000749b97477f0584e23352f18a3efb703265beebe931b4f12aff4ef3ad89e7330b919ad02780b676f832de756c96d959f3070834376ca579876240847
6
+ metadata.gz: a043003e7a44b38dbf5cc6524ad82069b05e9b25b84ae86ec1b37ce7eb1ee6411798345206e4a8d3821ca5111288111b99557b7a4e94a49dc97cbe870d3c6f16
7
+ data.tar.gz: 81193329f1814dc989b05f6f0f5be3808b11d881b9c64ca73e540237df4f0947cdb9001722d3687352fb41d60d7c55d68e64cde581e92bfa05caa232ea9640ce
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- ## 2.10.0 [unreleased]
1
+ ## 3.0.0 [unreleased]
2
+
3
+ ### Bug Fixes
4
+ 1. [#131](https://github.com/influxdata/influxdb-client-ruby/pull/131): Convert time objects present in fields to integer. Prior to this change the timestamps were converted to strings
2
5
 
3
6
  ## 2.9.0 [2022-12-01]
4
7
 
@@ -127,7 +127,7 @@ module InfluxDB2
127
127
  return nil if fields.empty?
128
128
 
129
129
  line_protocol << " #{fields}" if fields
130
- timestamp = _escape_time
130
+ timestamp = _escape_time(@time)
131
131
  line_protocol << " #{timestamp}" if timestamp
132
132
 
133
133
  line_protocol
@@ -185,6 +185,8 @@ module InfluxDB2
185
185
  '"'.freeze + result + '"'.freeze
186
186
  elsif value.is_a?(Integer)
187
187
  "#{value}i"
188
+ elsif value.is_a?(Time)
189
+ "#{_escape_time(value)}i"
188
190
  elsif [Float::INFINITY, -Float::INFINITY].include?(value)
189
191
  ''
190
192
  else
@@ -192,16 +194,16 @@ module InfluxDB2
192
194
  end
193
195
  end
194
196
 
195
- def _escape_time
196
- if @time.nil?
197
+ def _escape_time(value)
198
+ if value.nil?
197
199
  nil
198
- elsif @time.is_a?(Integer)
199
- @time.to_s
200
- elsif @time.is_a?(Float)
201
- @time.round.to_s
202
- elsif @time.is_a?(Time)
203
- nano_seconds = @time.to_i * 1e9
204
- nano_seconds += @time.tv_nsec
200
+ elsif value.is_a?(Integer)
201
+ value.to_s
202
+ elsif value.is_a?(Float)
203
+ value.round.to_s
204
+ elsif value.is_a?(Time)
205
+ nano_seconds = value.to_i * 1e9
206
+ nano_seconds += value.tv_nsec
205
207
  case @precision || DEFAULT_WRITE_PRECISION
206
208
  when InfluxDB2::WritePrecision::MILLISECOND then
207
209
  (nano_seconds / 1e6).round
@@ -213,7 +215,7 @@ module InfluxDB2
213
215
  nano_seconds.round
214
216
  end
215
217
  else
216
- @time.to_s
218
+ value.to_s
217
219
  end
218
220
  end
219
221
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module InfluxDB2
22
- VERSION = '2.10.0'.freeze
22
+ VERSION = '3.0.0'.freeze
23
23
  end
@@ -64,6 +64,7 @@ class PointTest < MiniTest::Test
64
64
  end
65
65
 
66
66
  def test_field_types
67
+ time = Time.utc(2023, 11, 1)
67
68
  point = InfluxDB2::Point.new(name: 'h2o')
68
69
  .add_tag('tag_b', 'b')
69
70
  .add_tag('tag_a', 'a')
@@ -73,8 +74,10 @@ class PointTest < MiniTest::Test
73
74
  .add_field('n4', 5.5)
74
75
  .add_field('bool', true)
75
76
  .add_field('string', 'string value')
77
+ .add_field('started', time)
76
78
 
77
- expected = 'h2o,tag_a=a,tag_b=b bool=true,n1=-2i,n2=10i,n3=1265437718438866624512i,n4=5.5,string="string value"'
79
+ expected = 'h2o,tag_a=a,tag_b=b bool=true,n1=-2i,n2=10i,n3=1265437718438866624512i,n4=5.5,'\
80
+ 'started=1698796800000000000i,string="string value"'
78
81
  assert_equal expected, point.to_line_protocol
79
82
  end
80
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0.pre.7445
4
+ version: 3.0.0.pre.7554
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Bednar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-14 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler