-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Helper get function for series (#66)
* chore: upgrade dependencies * doc: example * feat: helper GetXxx method * doc: readme and Example output
- Loading branch information
Showing
7 changed files
with
259 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,70 @@ | ||
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/GreptimeTeam/greptimedb-client-go/blob/main/LICENSE) | ||
[![Build Status](https://github.com/greptimeteam/greptimedb-client-go/actions/workflows/ci.yml/badge.svg)](https://github.com/GreptimeTeam/greptimedb-client-go/blob/main/.github/workflows/ci.yml) | ||
[![codecov](https://codecov.io/gh/GreptimeTeam/greptimedb-client-go/branch/main/graph/badge.svg?token=76KIKITADQ)](https://codecov.io/gh/GreptimeTeam/greptimedb-client-go) | ||
[![Go Reference](https://pkg.go.dev/badge/github.com/GreptimeTeam/greptimedb-client-go.svg)](https://pkg.go.dev/github.com/GreptimeTeam/greptimedb-client-go) | ||
# GreptimeDB Go Client | ||
|
||
Provide API for using GreptimeDB client in Go. | ||
|
||
## Installation | ||
|
||
```sh | ||
go get github.com/GreptimeTeam/greptimedb-client-go | ||
``` | ||
|
||
## Usage | ||
|
||
### Example | ||
|
||
you can visit [example](examples/request.go) for usage details. | ||
|
||
```shell | ||
go run examples/request.go | ||
``` | ||
## Example | ||
|
||
this will output the following: | ||
you can visit [Example][example] for usage details. | ||
|
||
```text | ||
Success! AffectedRows: value:1 | ||
Query monitors from db: [{host:localhost memory:1024 cpu:0.9 ts:{wall:4000000 ext:63817385045 loc:0xd6b740}}] | ||
``` | ||
## Usage | ||
|
||
### Datatype Supported | ||
#### Datatype Supported | ||
```go | ||
int32, int64, int (as int64), | ||
uint32, uint64, uint (as uint64), | ||
float64, | ||
float32, float64, | ||
bool, | ||
[]byte, | ||
string, | ||
time.Time (as int64), | ||
time.Time, | ||
``` | ||
|
||
```go | ||
// Attention! The following data types may cause conversion and are not recommended. | ||
int8, int16, // they will be stored as int32 | ||
uint8, uint16, // they will be stored as uint32 | ||
float32, // it will be stored as float64 | ||
[]byte, // it will be stored as string | ||
// Attention! The following data types may cause conversion, not recommended. | ||
int8, int16 // stored as int32 | ||
uint8, uint16 // stored as uint32 | ||
``` | ||
|
||
### More Options | ||
|
||
#### Precision for Timestamp | ||
|
||
The default precision is `Millisecond`, you can set a different precision before inserting into greptimedb. | ||
We support `Second`, `Millisecond`, `Microsecond` and `Nanosecond`. Once the precision is setted, you can not | ||
change it any more. | ||
The default precision is `Millisecond`, you can set a different precision, | ||
once the precision is setted, you can not change it any more. | ||
|
||
- `Second` | ||
- `Millisecond` | ||
- `Microsecond` | ||
- `Nanosecond` | ||
|
||
```go | ||
metric.SetTimePrecision(time.Microsecond) | ||
metric.SetTimePrecision(time.Microsecond) | ||
``` | ||
|
||
#### Stream Insert | ||
|
||
We support stream insert. You can send several insert request by `Send()` and notify DB the stream is at end by `CloseAndRecv()` | ||
You can send several insert request by `Send()` and notify DB no more messages by `CloseAndRecv()` | ||
|
||
you can visit `stream_client_test.go` for details | ||
you can visit [stream_client_test.go](stream_client_test.go) for details | ||
|
||
#### Prometheus | ||
|
||
We also support querying with RangePromql and Promql(TODO). | ||
|
||
you can visit `promql_test.go` for details | ||
you can visit [promql_test.go](promql_test.go) for details | ||
|
||
## License | ||
|
||
This greptimedb-client-go uses the __Apache 2.0 license__ to strike a balance between open contributions and allowing you to use the software however you want. | ||
This greptimedb-client-go uses the __Apache 2.0 license__ to strike a balance | ||
between open contributions and allowing you to use the software however you want. | ||
|
||
<!-- links --> | ||
[example]: https://pkg.go.dev/github.com/GreptimeTeam/greptimedb-client-go#example-package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.