Skip to content

Commit

Permalink
Merge pull request #125 from bonitoo-io/refactor/query-and-write-to-apis
Browse files Browse the repository at this point in the history
refactor: QueryApi, WriteApi, WriteApiBlocking and related objects moved into api
  • Loading branch information
vlastahajek authored May 15, 2020
2 parents 98dc31e + b53376b commit a4c1872
Show file tree
Hide file tree
Showing 30 changed files with 1,005 additions and 778 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
mkdir -p /tmp/artifacts
- run:
command: |
go test -v -e2e -race -coverprofile=coverage.txt -covermode=atomic ./...
go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg ./... -tags e2e
bash <(curl -s https://codecov.io/bash)
go tool cover -html=coverage.txt -o coverage.html
mv coverage.html /tmp/artifacts
Expand Down
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
## 1.2.0 [in progress]

### Breaking Changes
- [#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
- [#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
to provide consistent interface

### Features
1. [#120](https://github.com/influxdata/influxdb-client-go/pull/120) Health check API
1. [#122](https://github.com/influxdata/influxdb-client-go/pull/122) Delete API
1. [#124](https://github.com/influxdata/influxdb-client-go/pull/124) Buckets API

### Breaking Change
- [#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

### Bug fixes
1. [#108](https://github.com/influxdata/influxdb-client-go/issues/108) Fix default retry interval doc
1. [#110](https://github.com/influxdata/influxdb-client-go/issues/110) Allowing empty (nil) values in query result
Expand Down
135 changes: 1 addition & 134 deletions api/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,138 +2,5 @@
// Use of this source code is governed by MIT
// license that can be found in the LICENSE file.

// Package api provides clients for InfluxDB server APIs
//
// Examples
//
// Users API
//
// // Create influxdb client
// client := influxdb2.NewClient("http://localhost:9999", "my-token")
//
// // Find organization
// org, err := client.OrganizationsApi().FindOrganizationByName(context.Background(), "my-org")
// if err != nil {
// panic(err)
// }
//
// // Get users API client
// usersApi := client.UsersApi()
//
// // Create new user
// user, err := usersApi.CreateUserWithName(context.Background(), "user-01")
// if err != nil {
// panic(err)
// }
//
// // Set user password
// err = usersApi.UpdateUserPassword(context.Background(), user, "pass-at-least-8-chars")
// if err != nil {
// panic(err)
// }
//
// // Add user to organization
// _, err = client.OrganizationsApi().AddMember(context.Background(), org, user)
// if err != nil {
// panic(err)
// }
//
// Organizations API
//
// // Create influxdb client
// client := influxdb2.NewClient("http://localhost:9999", "my-token")
//
// // Get Organizations API client
// orgApi := client.OrganizationsApi()
//
// // Create new organization
// org, err := orgApi.CreateOrganizationWithName(context.Background(), "org-2")
// if err != nil {
// panic(err)
// }
//
// orgDescription := "My second org "
// org.Description = &orgDescription
//
// org, err = orgApi.UpdateOrganization(context.Background(), org)
// if err != nil {
// panic(err)
// }
//
// // Find user to set owner
// user, err := client.UsersApi().FindUserByName(context.Background(), "user-01")
// if err != nil {
// panic(err)
// }
//
// // Add another owner (first owner is the one who create organization
// _, err = orgApi.AddOwner(context.Background(), org, user)
// if err != nil {
// panic(err)
// }
//
// // Create new user to add to org
// newUser, err := client.UsersApi().CreateUserWithName(context.Background(), "user-02")
// if err != nil {
// panic(err)
// }
//
// // Add new user to organization
// _, err = orgApi.AddMember(context.Background(), org, newUser)
// if err != nil {
// panic(err)
// }
//
// Authorizations API
//
// // Create influxdb client
// client := influxdb2.NewClient("http://localhost:9999", "my-token")
//
// // Find user to grant permission
// user, err := client.UsersApi().FindUserByName(context.Background(), "user-01")
// if err != nil {
// panic(err)
// }
//
// // Find organization
// org, err := client.OrganizationsApi().FindOrganizationByName(context.Background(), "my-org")
// if err != nil {
// panic(err)
// }
//
// // create write permission for buckets
// permissionWrite := &domain.Permission{
// Action: domain.PermissionActionWrite,
// Resource: domain.Resource{
// Type: domain.ResourceTypeBuckets,
// },
// }
//
// // create read permission for buckets
// permissionRead := &domain.Permission{
// Action: domain.PermissionActionRead,
// Resource: domain.Resource{
// Type: domain.ResourceTypeBuckets,
// },
// }
//
// // group permissions
// permissions := []domain.Permission{*permissionWrite, *permissionRead}
//
// // create authorization object using info above
// auth := &domain.Authorization{
// OrgID: org.Id,
// Permissions: &permissions,
// User: &user.Name,
// UserID: user.Id,
// }
//
// // grant permission and create token
// authCreated, err := client.AuthorizationsApi().CreateAuthorization(context.Background(), auth)
// if err != nil {
// panic(err)
// }
//
// // Use token
// fmt.Println("Token: ", *authCreated.Token)
// Package api provides clients for InfluxDB server APIs.
package api
Loading

0 comments on commit a4c1872

Please sign in to comment.