Skip to content
Go API for quasardb
Go
Branch: master
Clone or download
kontrarian Merge pull request #25 from bureau14/qdb-2667-update-direct-api-entry…
…-names

Update statistics to use new entry name layout
Latest commit 2ff788e Aug 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts/tests [qdb-test-setup] Improve startup checks. Aug 1, 2019
.gitignore [git] Ignore thirdparty/quasardb. Aug 16, 2019
.gitmodules Add qdb-test-setup submodule. Aug 1, 2019
README.md QDB-2594 - Improve teamcity integration. Jul 23, 2019
all_examples_helper_test.go QDB-2594 - Improve teamcity integration. Jul 23, 2019
all_examples_test.go
all_test.go QDB-2594 - Improve teamcity integration. Jul 23, 2019
cluster.go Add URI formatter to endpoint structure. Jul 13, 2018
cluster_test.go QDB-2594 - Improve teamcity integration. Jul 23, 2019
constants.go Add constants. Apr 11, 2019
direct.go Add direct api Aug 9, 2019
direct_test.go
entry.go Add constants. Apr 11, 2019
entry_blob.go Case 1869 - Fix excessive memory usage. Feb 7, 2018
entry_blob_test.go Add Blob.GetNoAlloc. Sep 18, 2017
entry_integer.go Case 1869 - Fix excessive memory usage. Feb 7, 2018
entry_integer_test.go Improve test suite fiability. Sep 11, 2017
entry_test.go QDB-2594 - Improve teamcity integration. Jul 23, 2019
entry_timeseries.go Add extra_columns to batch table. Nov 14, 2018
entry_timeseries_aggregation.go Case 1994 - Remove the filter in the TS range API. Apr 27, 2018
entry_timeseries_batch.go Case 1952 - Multi table bulk insert. May 18, 2018
entry_timeseries_bulk.go Case 1845 - Update API with timeseries and bulk operations. Jan 15, 2018
entry_timeseries_columns.go Case 1869 - Fix excessive memory usage. Feb 7, 2018
entry_timeseries_points.go Case 1869 - Fix excessive memory usage. Feb 7, 2018
entry_timeseries_range.go Case 1994 - Remove the filter in the TS range API. Apr 27, 2018
entry_timeseries_test.go We cannot set an int before starting a row. May 7, 2019
error.go Rename Query -> Find && QueryExp -> Query. Nov 14, 2018
find.go Rename Query -> Find && QueryExp -> Query. Nov 14, 2018
find_test.go Rename Query -> Find && QueryExp -> Query. Nov 14, 2018
functional_listing.md Case 1971 - Remove hset. Apr 12, 2018
go.mod add go module May 15, 2019
go.sum add go module May 15, 2019
handle.go Return an empty array from prefix_get. May 7, 2019
handle_test.go QDB-2594 - Improve teamcity integration. Jul 23, 2019
json_objects.go QDB-2477 - [fix] Available sessions is an int instead of an array. May 13, 2019
library_link.go QDB-2594 - Improve teamcity integration. Jul 23, 2019
node.go Update statistics to use new entry names Aug 16, 2019
node_test.go [JSON] Do not remove trailing zero character from content length. Aug 16, 2019
qdbd_secure.cfg Add qdb-test-setup submodule. Aug 1, 2019
query.go Rename qdb_exp_query -> qdb_query. Rename scanned_rows_count -> scann… Nov 20, 2018
query_test.go Rename qdb_exp_query -> qdb_query. Rename scanned_rows_count -> scann… Nov 20, 2018
statistics.go Update statistics to use new entry names Aug 16, 2019
statistics_test.go QDB-2594 - Improve teamcity integration. Jul 23, 2019
time.go Case 1836 - Remove support for go1.9.0. Dec 15, 2017
utils.go Case 1869 - Fix excessive memory usage. Feb 7, 2018

README.md

Quasardb Go API

GoDoc

Note: The Go API works on Windows x64 and Unix-like operating systems. 32-bit Windows is not currently supported.

Warning: Early stage development version. Use at your own risk.

Warning: Go1.9.0 is not supported. If you encounter a compilation problem with time.go please upgrade.

Go API for quasardb.

Requirements

  1. Go compiler and tools
  2. quasardb daemon
  3. quasardb C API version corresponding to the OS you use
  4. The version of the quasardb C API must match the current git branch, the master branch corresponds to the nightly C API

Build instructions:

  1. go get -d github.com/bureau14/qdb-api-go
  2. Extract the downloaded C API into $GOPATH/src/github.com/bureau14/qdb-api-go/qdb

Test instructions:

  1. export QDB_SERVER_PATH=/path/to/qdb-server/bin # a path to a dir containing qdbd, qdb_cluster_keygen and qdb_user_add executables
  2. cd $GOPATH/src/github.com/bureau14/qdb-api-go
  3. go test

Coverage instructions:

  1. export QDB_SERVER_PATH=/path/to/qdb-server/bin # a path to a dir containing qdbd, qdb_cluster_keygen and qdb_user_add executables
  2. cd $GOPATH/src/github.com/bureau14/qdb-api-go
  3. go test -coverprofile=coverage.out
  4. go tool cover -html=coverage.out # if you want to see coverage detail in a browser

Usage (OS X)

  1. mkdir $GOPATH/src/<PROJECT>
  2. Extract the downloaded C API into $GOPATH/src/<PROJECT>/qdb
  3. Ensure quasardb C library is in the DYLD_LIBRARY_PATH: export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GOPATH/src/<PROJECT>/qdb/lib

Troubleshooting

If you encounter any problems, please create an issue in the bug tracker.

Getting started

Simple test

Assuming a non secured database (see "Setup a secured connection" section for secured databases)

import qdb "github.com/bureau14/qdb-api-go"
import "time"

func main() {
    handle, err := qdb.SetupHandle("qdb://127.0.0.1:2836", time.Duration(120) * time.Second)
    if err != nil {
        // do something with error
    }
    defer handle.Close()

    blob := handle.Blob("alias")

    content := []byte("content")
    err = blob.Put(content, qdb.NeverExpires())
    if err != nil {
        // do something with error
    }

    contentUpdate := []byte("updated content")
    err = blob.Update(contentUpdate, qdb.NeverExpires())
    if err != nil {
        // do something with error
    }

    blob.Remove()
}

The following tests samples are presuming you import as specified in the previous example. The error checking will be ommited for brevity.

Setup a non secure connection

    handle, err := qdb.SetupHandle("qdb://127.0.0.1:2836", time.Duration(120) * time.Second)

    // alternatively:
    handle := qdb.MustSetupHandle("qdb://127.0.0.1:2836", time.Duration(120) * time.Second)

Setup a secured connection

    handle, err := qdb.SetupSecureHandle("qdb://127.0.0.1:2836", "/path/to/cluster_public.key", "/path/to/user_private.key", time.Duration(120) * time.Second, qdb.EncryptNone)

    // alternatively:
    handle := qdb.MustSetupSecureHandle("qdb://127.0.0.1:2836", "/path/to/cluster_public.key", "/path/to/user_private.key", time.Duration(120) * time.Second, qdb.EncryptNone)

Setup a handle manually

This could prove useful if you need to manage the flow of creation of your handle.

    handle, err := qdb.NewHandle()

    // Set timeout
    err = handle.SetTimeout(time.Duration(120) * time.Second)

    // Set encryption if enabled server side
    err = handle.SetEncryption(qdb.EncryptAES)

    // add security if enabled server side
    clusterKey, err := ClusterKeyFromFile("/path/to/cluster_public.key")
    err = handle.AddClusterPublicKey(clusterKey)
    user, secret, err := ClusterKeyFromFile("/path/to/cluster_public.key")
    err = handle.AddUserCredentials(user, secret)

    // connect
    err = handle.Connect("qdb://127.0.0.1:2836)
You can’t perform that action at this time.