featurebase/client
Samir Patel 3681feeeb2
[FB-1024 FB-1590] Increase timerange (un-revert) (#2174)
previously we allowed users to specify a granularity for timestamp
e.g. seconds, milli, micro, nano
however we converted everything to nano before we stored it.
This reduced the allowed range for all time units to what
was allowed by timestamp. For example, with second granularity
you can represent billions of years within the capacity of
int64 but with nano its somewhere b/w 100-200 years.

So now, for timeunits of seconds, milli, and micro the range
is year 0001 - 9999. These limits come from what Go
supports.

So this uses unit specific function to translate
timestamps to values and vice versa to increase
the time range.

In the process of increasing the range for timestamp and subsequent
testing, I found and addressed a few bugs:
- min/max queries were not using timestamp specific comparators so
  added that.
- Values from Import/ingest come to FB as relative values to epoch
    whereas other BSI fields come as actual values and then
    becomes relative to their respective bases within FB. so some
    specific handling of that was added.
- However! Set queries use timestamp strings which are, of course,
    the actual value they designate. So they have to become
    relative.
- When bitdepth is 0, Min/maxUnsigned functions did not run
resulting in a count of 0 when there
was an actual value that was 0.

Also, this removes (now) dead code and updates/adds tests.
2022-08-04 15:20:45 -07:00
..
csv Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
docs remove attributes 2021-05-14 10:28:08 -04:00
egpool Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
batch.go [FB-1587] crash would occur if missing nil-entry in batch (#2145) 2022-07-12 17:20:55 -05:00
batch_test.go add timestamp nils to nullIndices (#2095) 2022-06-02 15:54:24 -05:00
client.go [FB-1024 FB-1590] Increase timerange (un-revert) (#2174) 2022-08-04 15:20:45 -07:00
client_it_test.go decode int base from schema in client code 2022-05-29 09:03:27 -05:00
client_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
cluster.go client side retry ingestAPI requests on primary host 2022-03-10 10:22:13 -06:00
cluster_test.go client side retry ingestAPI requests on primary host 2022-03-10 10:22:13 -06:00
doc.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
error.go client side retry ingestAPI requests on primary host 2022-03-10 10:22:13 -06:00
ingest_api_batch.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
ingest_api_batch_test.go client side retry ingestAPI requests on primary host 2022-03-10 10:22:13 -06:00
logimport.go add copyright notice back in 2021-12-10 11:01:04 -06:00
logimport_test.go add copyright notice back in 2021-12-10 11:01:04 -06:00
metrics.go "all bitmap" multi-field, single-shard ingest 2022-05-27 11:25:17 -05:00
orm.go don't encode 'base' in the field options json 2022-05-29 09:03:27 -05:00
orm_test.go Revert "FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)" 2022-06-17 14:58:30 -05:00
README.md remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
record.go add copyright notice back in 2021-12-10 11:01:04 -06:00
record_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
response.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
response_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
shardnodes.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
tracer.go add copyright notice back in 2021-12-10 11:01:04 -06:00
validate.go add copyright notice back in 2021-12-10 11:01:04 -06:00
validate_test.go add copyright notice back in 2021-12-10 11:01:04 -06:00
version.go add copyright notice back in 2021-12-10 11:01:04 -06:00

Go Client for Pilosa

Go client for Pilosa high performance distributed index.

Usage

If you have the pilosa repo in your GOPATH, you can import the library in your code using:

import "github.com/pilosa/pilosa/v2/client"

Quick overview

Assuming Pilosa server is running at localhost:10101 (the default):

package main

import (
	"fmt"

	"github.com/pilosa/pilosa/v2/client"
)

func main() {
	// Create the default client
	cli := client.DefaultClient()

	// Retrieve the schema
	schema, err := cli.Schema()

	// Create an Index object
	myindex := schema.Index("myindex")

	// Create a Field object
	myfield := myindex.Field("myfield")

	// make sure the index and the field exists on the server
	err := cli.SyncSchema(schema)

	// Send a Set query. If err is non-nil, response will be nil.
	response, err := cli.Query(myfield.Set(5, 42))

	// Send a Row query. If err is non-nil, response will be nil.
	response, err = cli.Query(myfield.Row(5))

	// Get the result
	result := response.Result()
	// Act on the result
	if result != nil {
		columns := result.Row().Columns
		fmt.Println("Got columns: ", columns)
	}

	// You can batch queries to improve throughput
	response, err = cli.Query(myindex.BatchQuery(
		myfield.Row(5),
		myfield.Row(10)))
	if err != nil {
		fmt.Println(err)
	}

	for _, result := range response.Results() {
		// Act on the result
		fmt.Println(result.Row().Columns)
	}
}

Documentation

Data Model and Queries

See: Data Model and Queries

Executing Queries

See: Server Interaction

Other Documentation