support for uint64_t values for fields
Hi
I am getting errors for supporting uint64_t values insertions into influxDB What is your suggestion to fix this?
test.cpp:122:114: error: cannot convert ‘long long unsigned int’ to ‘const std::variant<int, long long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&’
122 | db->write(influxdb::Point{"pooya"}.addTag("guid","2032489038270972513").addTag("port","5").addField("rcv_data", (unsigned long long int)18446744073709551615).addField("unicast_xmit_pkts",2072512).addField("unicast_rcv_pkts", 2512).addField("multicast_xmit_pkts",55805).addField("multicast_rcv_pkts",29));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long long unsigned int
In file included from /usr/local/include/InfluxDB.h:38,
from /usr/local/include/InfluxDBFactory.h:31,
from test.cpp:32:
/usr/local/include/Point.h:55:106: note: initializing argument 2 of ‘influxdb::Point&& influxdb::Point::addField(std::string_view, const std::variant<int, long long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&)’
55 | Point&& addField(std::string_view name, const std::variant<int, long long int, std::string, double>& value);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
addField() doesn't support unsigned types yet. If your values fit into a int64_t you can cast them.
Support for unsigned types is possible to implement though.
Following up on this. Have you implemented the support for unsigned types?
Thanks for the ping, I'm quite behind my todos.
According to docs, the only integer type is signed 64-bit. ~~So deprecating the current addField() and adding one with uint64 instead of int and long long int should work – instead of extending the current variant.~~
Thinking further, I'm not sure whether uint64 is a good idea, given uint64 can hold a larger value than the specified int64.
Update: Influxdb 2.x supports uint64: https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/#uinteger