InfluxCommunity / influxdb3-go

The go package that provides a simple and convenient way to interact with InfluxDB 3.
https://pkg.go.dev/github.com/InfluxCommunity/influxdb3-go
MIT License
21 stars 11 forks source link

feat: add structured query #45

Closed bednar closed 8 months ago

bednar commented 9 months ago

Closes #14 Closes #43 Closes #44

Proposed Changes

The user is able to query data into structured object and write this object back to database.

Checklist

codecov[bot] commented 9 months ago

Codecov Report

Attention: 46 lines in your changes are missing coverage. Please review.

Comparison is base (3cede62) 83.84% compared to head (8c5ed18) 82.89%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #45 +/- ## ========================================== - Coverage 83.84% 82.89% -0.96% ========================================== Files 10 11 +1 Lines 681 912 +231 ========================================== + Hits 571 756 +185 - Misses 95 128 +33 - Partials 15 28 +13 ``` | [Files](https://app.codecov.io/gh/InfluxCommunity/influxdb3-go/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=InfluxCommunity) | Coverage Δ | | |---|---|---| | [influxdb3/query.go](https://app.codecov.io/gh/InfluxCommunity/influxdb3-go/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=InfluxCommunity#diff-aW5mbHV4ZGIzL3F1ZXJ5Lmdv) | `82.08% <100.00%> (ø)` | | | [influxdb3/query\_type.go](https://app.codecov.io/gh/InfluxCommunity/influxdb3-go/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=InfluxCommunity#diff-aW5mbHV4ZGIzL3F1ZXJ5X3R5cGUuZ28=) | `100.00% <ø> (ø)` | | | [influxdb3/write.go](https://app.codecov.io/gh/InfluxCommunity/influxdb3-go/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=InfluxCommunity#diff-aW5mbHV4ZGIzL3dyaXRlLmdv) | `97.65% <100.00%> (+0.09%)` | :arrow_up: | | [influxdb3/point.go](https://app.codecov.io/gh/InfluxCommunity/influxdb3-go/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=InfluxCommunity#diff-aW5mbHV4ZGIzL3BvaW50Lmdv) | `95.91% <94.00%> (-4.09%)` | :arrow_down: | | [influxdb3/query\_iterator.go](https://app.codecov.io/gh/InfluxCommunity/influxdb3-go/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=InfluxCommunity#diff-aW5mbHV4ZGIzL3F1ZXJ5X2l0ZXJhdG9yLmdv) | `50.70% <55.26%> (+1.66%)` | :arrow_up: | | [influxdb3/point\_values.go](https://app.codecov.io/gh/InfluxCommunity/influxdb3-go/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=InfluxCommunity#diff-aW5mbHV4ZGIzL3BvaW50X3ZhbHVlcy5nbw==) | `83.08% <83.08%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

arukiidou commented 8 months ago

please add SetUIntegerField.

nrhvyc commented 8 months ago

Why use Setter functions here instead of following the convention used by func (c *Client) WriteData{} which uses field tags? It's not like Values is a private field that would require a setter. Doesn't feel like idiomatic Go code.

type TemperatureSensor struct { Measurement string lp:"measurement" Sensor string lp:"tag,sensor" ID string lp:"tag,device_id" Temp float64 lp:"field,temperature" Hum int lp:"field,humidity" Time time.Time lp:"timestamp" Description string lp:"-" }

bednar commented 8 months ago

Hi @nrhvyc,

Thank you for your input. Could you please provide more details about your suggestion? I'm not sure I've fully understood what you are proposing. Any additional information you can provide would be helpful.

Best regards

bednar commented 8 months ago

@arukiidou

please add SetUIntegerField.

I will update this PR

bednar commented 8 months ago

@nrhvyc, please feel free to suggest improvements to the client. We are always happy to consider changes that will enhance usability for our community. Our minds are open. ;)