Skip to content
Go client library for Pilosa
Branch: master
Clone or download
yuce Merge pull request #220 from yuce/shardwidth-in-schema
index shard width is loaded from the server
Latest commit 72b91a0 Mar 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
csv
docs added RowRange call Jan 11, 2019
gopilosa_pbuf
.gitignore Add CircleCI builds and improve Makefile Sep 18, 2018
.travis.yml
CHANGELOG.md Added OptClientManualServerAddress option Feb 20, 2019
CONTRIBUTING.md
LICENSE Added license Apr 29, 2017
Makefile
README.md
client.go
client_internal_it_test.go Add CircleCI builds and improve Makefile Sep 18, 2018
client_it_test.go improved coverage Mar 4, 2019
client_test.go
cluster.go trivial update Sep 25, 2017
cluster_test.go
doc.go
error.go
error_test.go Renamed PilosaError to Error; more go report fixes May 1, 2017
full_coverage_test.go Implements the Store call Oct 4, 2018
go.mod convert from dep to go modules Feb 14, 2019
go.sum
import_manager.go if index has no shard width, set it to default. Mar 20, 2019
imports.go
imports_test.go
make.cmd make commands are supported on windows Jun 23, 2017
orm.go Merge pull request #220 from yuce/shardwidth-in-schema Mar 21, 2019
orm_test.go Merge pull request #220 from yuce/shardwidth-in-schema Mar 21, 2019
response.go
response_test.go Improved coverage; added index.Opts and field.Opts. Jan 9, 2019
uri.go
uri_test.go
validate.go Removes index/field validation. Updated docs. Jul 18, 2018
validate_test.go
version.go goreportcard fixes Feb 25, 2019

README.md

Go Client for Pilosa

GoDoc

Go client for Pilosa high performance distributed index.

What's New?

See: CHANGELOG

Requirements

  • Go 1.10 and higher

Install

Download the library in your GOPATH using:

go get github.com/pilosa/go-pilosa

After that, you can import the library in your code using:

import "github.com/pilosa/go-pilosa"

Usage

Quick overview

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

package main

import (
	"fmt"

	"github.com/pilosa/go-pilosa"
)

func main() {
	var err error

	// Create the default client
	client := pilosa.DefaultClient()

	// Retrieve the schema
	schema, err := client.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 = client.SyncSchema(schema)

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

	// Send a Row query. If err is non-nil, response will be nil.
	response, err = client.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 = client.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

Importing and Exporting Data

See: Importing and Exporting Data

Contributing

See: CONTRIBUTING

License

See: LICENSE

You can’t perform that action at this time.