From bc28c6112aef43e9a9bdee62f269dbef18083f49 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Tue, 12 Nov 2024 10:58:19 +0100 Subject: [PATCH] chore: prepare major version 1 --- README.md | 2 +- examples/Basic/basic.go | 5 ++--- examples/Batching/batching.go | 7 +++---- examples/Downsampling/downsampling.go | 10 +++++----- examples/HTTPErrorHandled/httpErrorHandled.go | 2 +- examples/LPBatching/lpBatching.go | 7 +++---- go.mod | 2 +- influxdb3/batching/batcher.go | 2 +- influxdb3/batching/batcher_test.go | 2 +- influxdb3/batching/example_test.go | 4 ++-- influxdb3/client_e2e_test.go | 4 ++-- influxdb3/write.go | 2 +- 12 files changed, 23 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 5042817..53fe095 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ import ( "fmt" "os" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/influxdb3/v1" ) ``` diff --git a/examples/Basic/basic.go b/examples/Basic/basic.go index 7c9378b..598056f 100644 --- a/examples/Basic/basic.go +++ b/examples/Basic/basic.go @@ -6,8 +6,7 @@ import ( "os" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" - "github.com/apache/arrow/go/v15/arrow" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" ) func main() { @@ -104,7 +103,7 @@ func main() { // The keys are the column names, allowing you to access the values by column name. value := iterator.Value() fmt.Printf("%s at %v:\n", value["location"], - (value["time"].(arrow.Timestamp)).ToTime(arrow.Nanosecond).Format(time.RFC822)) + (value["time"].(time.Time)).Format(time.RFC822)) fmt.Printf(" temperature: %f\n", value["temperature"]) fmt.Printf(" humidity : %d%%\n", value["humidity"]) } diff --git a/examples/Batching/batching.go b/examples/Batching/batching.go index d41052d..a0e2b4e 100644 --- a/examples/Batching/batching.go +++ b/examples/Batching/batching.go @@ -8,9 +8,8 @@ import ( "text/tabwriter" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" - "github.com/InfluxCommunity/influxdb3-go/influxdb3/batching" - "github.com/apache/arrow/go/v15/arrow" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3/batching" ) const NumPoints = 54 @@ -142,7 +141,7 @@ func main() { // Process the data for iterator.Next() { value := iterator.Value() - t := (value["time"].(arrow.Timestamp)).ToTime(arrow.Nanosecond).Format(time.RFC3339) + t := (value["time"].(time.Time)).Format(time.RFC3339) fmt.Fprintf(w, "%v\t%s\t%.1f\t%d\n", t, value["location"], value["temperature"], value["humidity"]) } } diff --git a/examples/Downsampling/downsampling.go b/examples/Downsampling/downsampling.go index 1ed05ff..fb39f2b 100644 --- a/examples/Downsampling/downsampling.go +++ b/examples/Downsampling/downsampling.go @@ -3,11 +3,11 @@ package main import ( "context" "fmt" + "github.com/apache/arrow/go/v15/arrow" "os" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" - "github.com/apache/arrow/go/v15/arrow" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" ) func main() { @@ -96,10 +96,10 @@ func main() { for iterator.Next() { row := iterator.AsPoints() timestamp := (row.GetField("window_start").(arrow.Timestamp)).ToTime(arrow.Nanosecond) - location := row.GetStringField("location") + location, _ := row.GetTag("location") avgValue := row.GetDoubleField("avg") maxValue := row.GetDoubleField("max") - fmt.Printf("%s %s temperature: avg %.2f, max %.2f\n", timestamp.Format(time.RFC822), *location, *avgValue, *maxValue) + fmt.Printf("%s %s temperature: avg %.2f, max %.2f\n", timestamp.Format(time.RFC822), location, *avgValue, *maxValue) // // Write back downsampled data. @@ -114,7 +114,7 @@ func main() { downsampledPoint = downsampledPoint. RemoveField("window_start"). SetTimestampWithEpoch(timestamp.UnixNano()) - + // Write the downsampled Point to the database. err = client.WritePoints(context.Background(), []*influxdb3.Point{downsampledPoint}) if err != nil { diff --git a/examples/HTTPErrorHandled/httpErrorHandled.go b/examples/HTTPErrorHandled/httpErrorHandled.go index 7809c27..e2c4b84 100644 --- a/examples/HTTPErrorHandled/httpErrorHandled.go +++ b/examples/HTTPErrorHandled/httpErrorHandled.go @@ -7,7 +7,7 @@ import ( "log" "os" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" ) // Demonstrates working with HTTP response headers in ServerError diff --git a/examples/LPBatching/lpBatching.go b/examples/LPBatching/lpBatching.go index cd4a44d..88658c8 100644 --- a/examples/LPBatching/lpBatching.go +++ b/examples/LPBatching/lpBatching.go @@ -9,9 +9,8 @@ import ( "text/tabwriter" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" - "github.com/InfluxCommunity/influxdb3-go/influxdb3/batching" - "github.com/apache/arrow/go/v15/arrow" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3/batching" ) const LineCount = 100 @@ -133,7 +132,7 @@ func main() { fmt.Fprintln(tw, "\nTime\tid\tlocation\tspeed\tbearing\tticks") for iterator.Next() { value := iterator.Value() - t := (value["time"].(arrow.Timestamp)).ToTime(arrow.Nanosecond).Format(time.RFC3339) + t := (value["time"].(time.Time)).Format(time.RFC3339) _, err := fmt.Fprintf(tw, "%v\t%s\t%s\t%.1f\t%.2f\t%d\n", t, value["id"], value["location"], value["speed"], value["bearing"], value["ticks"]) if err != nil { diff --git a/go.mod b/go.mod index 90aebcd..71804e2 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/InfluxCommunity/influxdb3-go +module github.com/InfluxCommunity/influxdb3-go/v1 go 1.22.7 diff --git a/influxdb3/batching/batcher.go b/influxdb3/batching/batcher.go index c9ff2ce..6bd0ba8 100644 --- a/influxdb3/batching/batcher.go +++ b/influxdb3/batching/batcher.go @@ -28,7 +28,7 @@ import ( "log/slog" "sync" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" ) // DefaultBatchSize is the default number of points emitted diff --git a/influxdb3/batching/batcher_test.go b/influxdb3/batching/batcher_test.go index c8c403c..fe6b3a7 100644 --- a/influxdb3/batching/batcher_test.go +++ b/influxdb3/batching/batcher_test.go @@ -27,7 +27,7 @@ import ( "testing" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" "github.com/stretchr/testify/assert" ) diff --git a/influxdb3/batching/example_test.go b/influxdb3/batching/example_test.go index 421923c..c7dbd18 100644 --- a/influxdb3/batching/example_test.go +++ b/influxdb3/batching/example_test.go @@ -29,8 +29,8 @@ import ( "math/rand" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" - "github.com/InfluxCommunity/influxdb3-go/influxdb3/batching" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3/batching" ) func Example_batcher() { diff --git a/influxdb3/client_e2e_test.go b/influxdb3/client_e2e_test.go index 664b152..17d64cb 100644 --- a/influxdb3/client_e2e_test.go +++ b/influxdb3/client_e2e_test.go @@ -37,8 +37,8 @@ import ( "testing" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3" - "github.com/InfluxCommunity/influxdb3-go/influxdb3/batching" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3/batching" "github.com/influxdata/line-protocol/v2/lineprotocol" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/influxdb3/write.go b/influxdb3/write.go index 2a9467e..de796e0 100644 --- a/influxdb3/write.go +++ b/influxdb3/write.go @@ -33,7 +33,7 @@ import ( "strings" "time" - "github.com/InfluxCommunity/influxdb3-go/influxdb3/gzip" + "github.com/InfluxCommunity/influxdb3-go/v1/influxdb3/gzip" "github.com/influxdata/line-protocol/v2/lineprotocol" )