Skip to content

Commit a4c1872

Browse files
authored
Merge pull request #125 from bonitoo-io/refactor/query-and-write-to-apis
refactor: QueryApi, WriteApi, WriteApiBlocking and related objects moved into api
2 parents 98dc31e + b53376b commit a4c1872

30 files changed

+1005
-778
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
mkdir -p /tmp/artifacts
4040
- run:
4141
command: |
42-
go test -v -e2e -race -coverprofile=coverage.txt -covermode=atomic ./...
42+
go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg ./... -tags e2e
4343
bash <(curl -s https://codecov.io/bash)
4444
go tool cover -html=coverage.txt -o coverage.html
4545
mv coverage.html /tmp/artifacts

CHANGELOG.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
## 1.2.0 [in progress]
2+
3+
### Breaking Changes
4+
- [#107](https://github.com/influxdata/influxdb-client-go/pull/107) Renamed `InfluxDBClient` interface to `Client`, so the full name `influxdb2.Client` suits better to Go naming conventions
5+
- [#125](https://github.com/influxdata/influxdb-client-go/pull/125) `WriteApi`,`WriteApiBlocking`,`QueryApi` interfaces and related objects like `Point`, `FluxTableMetadata`, `FluxTableColumn`, `FluxRecord`, moved to the `api` ( and `api/write`, `api/query`) packages
6+
to provide consistent interface
7+
28
### Features
39
1. [#120](https://github.com/influxdata/influxdb-client-go/pull/120) Health check API
410
1. [#122](https://github.com/influxdata/influxdb-client-go/pull/122) Delete API
511
1. [#124](https://github.com/influxdata/influxdb-client-go/pull/124) Buckets API
612

7-
### Breaking Change
8-
- [#107](https://github.com/influxdata/influxdb-client-go/pull/100) Renamed `InfluxDBClient` interface to `Client`, so the full name `influxdb2.Client` suits better to Go naming conventions
9-
1013
### Bug fixes
1114
1. [#108](https://github.com/influxdata/influxdb-client-go/issues/108) Fix default retry interval doc
1215
1. [#110](https://github.com/influxdata/influxdb-client-go/issues/110) Allowing empty (nil) values in query result

api/doc.go

+1-134
Original file line numberDiff line numberDiff line change
@@ -2,138 +2,5 @@
22
// Use of this source code is governed by MIT
33
// license that can be found in the LICENSE file.
44

5-
// Package api provides clients for InfluxDB server APIs
6-
//
7-
// Examples
8-
//
9-
// Users API
10-
//
11-
// // Create influxdb client
12-
// client := influxdb2.NewClient("http://localhost:9999", "my-token")
13-
//
14-
// // Find organization
15-
// org, err := client.OrganizationsApi().FindOrganizationByName(context.Background(), "my-org")
16-
// if err != nil {
17-
// panic(err)
18-
// }
19-
//
20-
// // Get users API client
21-
// usersApi := client.UsersApi()
22-
//
23-
// // Create new user
24-
// user, err := usersApi.CreateUserWithName(context.Background(), "user-01")
25-
// if err != nil {
26-
// panic(err)
27-
// }
28-
//
29-
// // Set user password
30-
// err = usersApi.UpdateUserPassword(context.Background(), user, "pass-at-least-8-chars")
31-
// if err != nil {
32-
// panic(err)
33-
// }
34-
//
35-
// // Add user to organization
36-
// _, err = client.OrganizationsApi().AddMember(context.Background(), org, user)
37-
// if err != nil {
38-
// panic(err)
39-
// }
40-
//
41-
// Organizations API
42-
//
43-
// // Create influxdb client
44-
// client := influxdb2.NewClient("http://localhost:9999", "my-token")
45-
//
46-
// // Get Organizations API client
47-
// orgApi := client.OrganizationsApi()
48-
//
49-
// // Create new organization
50-
// org, err := orgApi.CreateOrganizationWithName(context.Background(), "org-2")
51-
// if err != nil {
52-
// panic(err)
53-
// }
54-
//
55-
// orgDescription := "My second org "
56-
// org.Description = &orgDescription
57-
//
58-
// org, err = orgApi.UpdateOrganization(context.Background(), org)
59-
// if err != nil {
60-
// panic(err)
61-
// }
62-
//
63-
// // Find user to set owner
64-
// user, err := client.UsersApi().FindUserByName(context.Background(), "user-01")
65-
// if err != nil {
66-
// panic(err)
67-
// }
68-
//
69-
// // Add another owner (first owner is the one who create organization
70-
// _, err = orgApi.AddOwner(context.Background(), org, user)
71-
// if err != nil {
72-
// panic(err)
73-
// }
74-
//
75-
// // Create new user to add to org
76-
// newUser, err := client.UsersApi().CreateUserWithName(context.Background(), "user-02")
77-
// if err != nil {
78-
// panic(err)
79-
// }
80-
//
81-
// // Add new user to organization
82-
// _, err = orgApi.AddMember(context.Background(), org, newUser)
83-
// if err != nil {
84-
// panic(err)
85-
// }
86-
//
87-
// Authorizations API
88-
//
89-
// // Create influxdb client
90-
// client := influxdb2.NewClient("http://localhost:9999", "my-token")
91-
//
92-
// // Find user to grant permission
93-
// user, err := client.UsersApi().FindUserByName(context.Background(), "user-01")
94-
// if err != nil {
95-
// panic(err)
96-
// }
97-
//
98-
// // Find organization
99-
// org, err := client.OrganizationsApi().FindOrganizationByName(context.Background(), "my-org")
100-
// if err != nil {
101-
// panic(err)
102-
// }
103-
//
104-
// // create write permission for buckets
105-
// permissionWrite := &domain.Permission{
106-
// Action: domain.PermissionActionWrite,
107-
// Resource: domain.Resource{
108-
// Type: domain.ResourceTypeBuckets,
109-
// },
110-
// }
111-
//
112-
// // create read permission for buckets
113-
// permissionRead := &domain.Permission{
114-
// Action: domain.PermissionActionRead,
115-
// Resource: domain.Resource{
116-
// Type: domain.ResourceTypeBuckets,
117-
// },
118-
// }
119-
//
120-
// // group permissions
121-
// permissions := []domain.Permission{*permissionWrite, *permissionRead}
122-
//
123-
// // create authorization object using info above
124-
// auth := &domain.Authorization{
125-
// OrgID: org.Id,
126-
// Permissions: &permissions,
127-
// User: &user.Name,
128-
// UserID: user.Id,
129-
// }
130-
//
131-
// // grant permission and create token
132-
// authCreated, err := client.AuthorizationsApi().CreateAuthorization(context.Background(), auth)
133-
// if err != nil {
134-
// panic(err)
135-
// }
136-
//
137-
// // Use token
138-
// fmt.Println("Token: ", *authCreated.Token)
5+
// Package api provides clients for InfluxDB server APIs.
1396
package api

0 commit comments

Comments
 (0)