pilosa

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2019 License: BSD-3-Clause Imports: 27 Imported by: 39

README

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

Other Documentation

Contributing

See: CONTRIBUTING

License

See: LICENSE

Documentation

Overview

Package pilosa enables querying a Pilosa server.

This client uses Pilosa's http+protobuf API.

Usage:

import (
	"fmt"
	pilosa "github.com/pilosa/go-pilosa"
)

// Create a Client instance
client := pilosa.DefaultClient()

// Create a Schema instance
schema, err := client.Schema()
if err != nil {
	panic(err)
}

// Create an Index instance
index, err := schema.Index("repository")
if err != nil {
	panic(err)
}

// Create a Field instance
stargazer, err := index.Field("stargazer")
if err != nil {
	panic(err)
}

// Sync the schema with the server-side, so non-existing indexes/fields are created on the server-side.
err = client.SyncSchema(schema)
if err != nil {
	panic(err)
}

// Execute a query
response, err := client.Query(stargazer.Row(5))
if err != nil {
	panic(err)
}

// Act on the result
fmt.Println(response.Result())

See also https://www.pilosa.com/docs/api-reference/ and https://www.pilosa.com/docs/query-language/.

Index

Constants

View Source
const (
	QueryResultTypeNil uint32 = iota
	QueryResultTypeRow
	QueryResultTypePairs
	QueryResultTypeValCount
	QueryResultTypeUint64
	QueryResultTypeBool
	QueryResultTypeRowIDs // this is not used by the client
	QueryResultTypeGroupCounts
	QueryResultTypeRowIdentifiers
)

QueryResponse types.

View Source
const CacheSizeDefault = 0

CacheSizeDefault is the default cache size

View Source
const DefaultShardWidth = 1 << 20

DefaultShardWidth is used if an index doesn't have it defined.

View Source
const PQLVersion = "1.0"

PQLVersion is the version of PQL expected by the client

View Source
const Version = "v1.3.0"

Version is the client version.

Variables

View Source
var (
	ErrEmptyCluster                = NewError("No usable addresses in the cluster")
	ErrIndexExists                 = NewError("Index exists")
	ErrFieldExists                 = NewError("Field exists")
	ErrInvalidIndexName            = NewError("Invalid index name")
	ErrInvalidFieldName            = NewError("Invalid field name")
	ErrInvalidLabel                = NewError("Invalid label")
	ErrInvalidKey                  = NewError("Invalid key")
	ErrTriedMaxHosts               = NewError("Tried max hosts, still failing")
	ErrAddrURIClusterExpected      = NewError("Addresses, URIs or a cluster is expected")
	ErrInvalidQueryOption          = NewError("Invalid query option")
	ErrInvalidIndexOption          = NewError("Invalid index option")
	ErrInvalidFieldOption          = NewError("Invalid field option")
	ErrNoFragmentNodes             = NewError("No fragment nodes")
	ErrNoShard                     = NewError("Index has no shards")
	ErrUnknownType                 = NewError("Unknown type")
	ErrSingleServerAddressRequired = NewError("OptClientManualServerAddress requires a single URI or address")
	ErrInvalidAddress              = NewError("Invalid address")
)

Predefined Pilosa errors.

Functions

func ValidKey added in v0.9.0

func ValidKey(key string) bool

ValidKey returns true if the given key is valid, otherwise false.

func ValidLabel

func ValidLabel(label string) bool

ValidLabel returns true if the given label is valid, otherwise false.

Types

type BoolResult added in v0.9.0

type BoolResult bool

BoolResult is returned from Set and Clear calls.

func (BoolResult) Changed added in v0.9.0

func (b BoolResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (BoolResult) Count added in v0.9.0

func (BoolResult) Count() int64

Count returns the result of a Count call.

func (BoolResult) CountItems added in v0.9.0

func (BoolResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (BoolResult) GroupCounts added in v1.3.0

func (BoolResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (BoolResult) Row added in v0.10.0

func (BoolResult) Row() RowResult

Row returns a RowResult.

func (BoolResult) RowIdentifiers added in v1.3.0

func (BoolResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (BoolResult) Type added in v0.9.0

func (BoolResult) Type() uint32

Type is the type of this result.

func (BoolResult) Value added in v0.9.0

func (BoolResult) Value() int64

Value returns the result of a Min, Max or Sum call.

type CacheType

type CacheType string

CacheType represents cache type for a field

const (
	CacheTypeDefault CacheType = ""
	CacheTypeLRU     CacheType = "lru"
	CacheTypeRanked  CacheType = "ranked"
	CacheTypeNone    CacheType = "none"
)

CacheType constants

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the HTTP client for Pilosa server.

func DefaultClient

func DefaultClient() *Client

DefaultClient creates a client with the default address and options.

func NewClient added in v0.8.0

func NewClient(addrURIOrCluster interface{}, options ...ClientOption) (*Client, error)

NewClient creates a client with the given address, URI, or cluster and options.

func (*Client) CreateField added in v0.10.0

func (c *Client) CreateField(field *Field) error

CreateField creates a field on the server using the given Field struct.

func (*Client) CreateIndex

func (c *Client) CreateIndex(index *Index) error

CreateIndex creates an index on the server using the given Index struct.

func (*Client) DeleteField added in v0.7.0

func (c *Client) DeleteField(field *Field) error

DeleteField deletes a field on the server.

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(index *Index) error

DeleteIndex deletes an index on the server.

func (*Client) EnsureField added in v0.10.0

func (c *Client) EnsureField(field *Field) error

EnsureField creates a field on the server if it doesn't exists.

func (*Client) EnsureIndex

func (c *Client) EnsureIndex(index *Index) error

EnsureIndex creates an index on the server if it does not exist.

func (*Client) ExperimentalReplayImport added in v1.3.0

func (c *Client) ExperimentalReplayImport(r io.Reader) error

ExperimentalReplayImport takes a data stream which was previously recorded by the import logging functionality and imports it to Pilosa. The target cluster need not be of the same size as the original cluster, but it must already have the necessary schema in place. It is an experimental method and may be changed or removed.

func (*Client) ExportField added in v0.10.0

func (c *Client) ExportField(field *Field) (io.Reader, error)

ExportField exports columns for a field.

func (*Client) HttpRequest added in v0.8.0

func (c *Client) HttpRequest(method string, path string, data []byte, headers map[string]string) (*http.Response, []byte, error)

HttpRequest sends an HTTP request to the Pilosa server. **NOTE**: This function is experimental and may be removed in later revisions.

func (*Client) ImportField added in v0.10.0

func (c *Client) ImportField(field *Field, iterator RecordIterator, options ...ImportOption) error

ImportField imports records from the given iterator.

func (*Client) Info added in v1.3.0

func (c *Client) Info() (Info, error)

Info returns the server's configuration/host information.

func (*Client) Query

func (c *Client) Query(query PQLQuery, options ...interface{}) (*QueryResponse, error)

Query runs the given query against the server with the given options. Pass nil for default options.

func (*Client) Schema

func (c *Client) Schema() (*Schema, error)

Schema returns the indexes and fields on the server.

func (*Client) Status added in v0.9.0

func (c *Client) Status() (Status, error)

Status returns the server's status.

func (*Client) SyncSchema added in v0.5.0

func (c *Client) SyncSchema(schema *Schema) error

SyncSchema updates a schema with the indexes and fields on the server and creates the indexes and fields in the schema on the server side. This function does not delete indexes and the fields on the server side nor in the schema.

type ClientOption added in v0.8.0

type ClientOption func(options *ClientOptions) error

ClientOption is used when creating a PilosaClient struct.

func ExperimentalOptClientLogImports added in v1.3.0

func ExperimentalOptClientLogImports(loc io.Writer) ClientOption

ExperimentalOptClientLogImports writes all imports to the given writer in such a way that they can easily be replayed into another Pilosa cluster. It is an experimental option and may be changed or removed.

func OptClientConnectTimeout added in v0.9.0

func OptClientConnectTimeout(timeout time.Duration) ClientOption

OptClientConnectTimeout is the maximum time to connect in nanoseconds.

func OptClientManualServerAddress added in v1.3.0

func OptClientManualServerAddress(enabled bool) ClientOption

OptClientManualServerAddress forces the client use only the manual server address

func OptClientPoolSizePerRoute added in v0.9.0

func OptClientPoolSizePerRoute(size int) ClientOption

OptClientPoolSizePerRoute is the maximum number of active connections in the pool to a host.

func OptClientSocketTimeout added in v0.9.0

func OptClientSocketTimeout(timeout time.Duration) ClientOption

OptClientSocketTimeout is the maximum idle socket time in nanoseconds

func OptClientTLSConfig added in v0.9.0

func OptClientTLSConfig(config *tls.Config) ClientOption

OptClientTLSConfig contains the TLS configuration.

func OptClientTotalPoolSize added in v0.9.0

func OptClientTotalPoolSize(size int) ClientOption

OptClientTotalPoolSize is the maximum number of connections in the pool.

func OptClientTracer added in v1.3.0

func OptClientTracer(tracer opentracing.Tracer) ClientOption

OptClientTracer sets the Open Tracing tracer See: https://opentracing.io

type ClientOptions

type ClientOptions struct {
	SocketTimeout    time.Duration
	ConnectTimeout   time.Duration
	PoolSizePerRoute int
	TotalPoolSize    int
	TLSConfig        *tls.Config
	// contains filtered or unexported fields
}

ClientOptions control the properties of client connection to the server.

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

Cluster contains hosts in a Pilosa cluster.

func DefaultCluster

func DefaultCluster() *Cluster

DefaultCluster returns the default Cluster.

func NewClusterWithHost

func NewClusterWithHost(hosts ...*URI) *Cluster

NewClusterWithHost returns a cluster with the given URIs.

func (*Cluster) AddHost

func (c *Cluster) AddHost(address *URI)

AddHost adds a host to the cluster.

func (*Cluster) Host

func (c *Cluster) Host() *URI

Host returns a host in the cluster.

func (*Cluster) Hosts

func (c *Cluster) Hosts() []URI

Hosts returns all available hosts in the cluster.

func (*Cluster) RemoveHost

func (c *Cluster) RemoveHost(address *URI)

RemoveHost black lists the host with the given URI from the cluster.

type Column added in v0.10.0

type Column struct {
	RowID     uint64
	ColumnID  uint64
	RowKey    string
	ColumnKey string
	Timestamp int64
}

Column defines a single Pilosa column.

func (Column) Less added in v0.10.0

func (b Column) Less(other Record) bool

Less returns true if this column sorts before the given Record.

func (Column) Shard added in v0.10.0

func (b Column) Shard(shardWidth uint64) uint64

Shard returns the shard for this column.

type ColumnItem

type ColumnItem struct {
	ID         uint64                 `json:"id,omitempty"`
	Key        string                 `json:"key,omitempty"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

ColumnItem represents data about a column. Column data is only returned if QueryOptions.Columns was set to true.

type CountResultItem

type CountResultItem struct {
	ID    uint64 `json:"id"`
	Key   string `json:"key,omitempty"`
	Count uint64 `json:"count"`
}

CountResultItem represents a result from TopN call.

func (*CountResultItem) String added in v0.8.0

func (c *CountResultItem) String() string

type Error

type Error struct {
	Message string
}

Error contains a Pilosa specific error.

func NewError

func NewError(message string) *Error

NewError creates a Pilosa error.

func (Error) Error

func (e Error) Error() string

type Field added in v0.10.0

type Field struct {
	// contains filtered or unexported fields
}

Field structs are used to segment and define different functional characteristics within your entire index. You can think of a Field as a table-like data partition within your Index. Row-level attributes are namespaced at the Field level.

func (*Field) Between added in v0.10.0

func (f *Field) Between(a int, b int) *PQLRowQuery

Between creates a between query.

func (*Field) Clear added in v0.10.0

func (f *Field) Clear(rowIDOrKey, colIDOrKey interface{}) *PQLBaseQuery

Clear creates a Clear query. Clear, assigns a value of 0 to a bit in the binary matrix, thus disassociating the given row in the given field from the given column.

func (*Field) ClearRow added in v1.2.0

func (f *Field) ClearRow(rowIDOrKey interface{}) *PQLBaseQuery

ClearRow creates a ClearRow query. ClearRow sets all bits to 0 in a given row of the binary matrix, thus disassociating the given row in the given field from all columns.

func (*Field) Equals added in v0.10.0

func (f *Field) Equals(n int) *PQLRowQuery

Equals creates an equals query.

func (*Field) FilterAttrTopN added in v0.10.0

func (f *Field) FilterAttrTopN(n uint64, row *PQLRowQuery, attrName string, attrValues ...interface{}) *PQLRowQuery

FilterAttrTopN creates a TopN query with the given item count, row, attribute name and filter values for that field The attrName and attrValues arguments work together to only return Rows which have the attribute specified by attrName with one of the values specified in attrValues.

func (*Field) GT added in v0.10.0

func (f *Field) GT(n int) *PQLRowQuery

GT creates a greater than query.

func (*Field) GTE added in v0.10.0

func (f *Field) GTE(n int) *PQLRowQuery

GTE creates a greater than or equal query.

func (*Field) LT added in v0.10.0

func (f *Field) LT(n int) *PQLRowQuery

LT creates a less than query.

func (*Field) LTE added in v0.10.0

func (f *Field) LTE(n int) *PQLRowQuery

LTE creates a less than or equal query.

func (*Field) Max added in v0.10.0

func (f *Field) Max(row *PQLRowQuery) *PQLBaseQuery

Max creates a min query.

func (*Field) Min added in v0.10.0

func (f *Field) Min(row *PQLRowQuery) *PQLBaseQuery

Min creates a min query.

func (*Field) Name added in v0.10.0

func (f *Field) Name() string

Name returns the name of the field

func (*Field) NotEquals added in v0.10.0

func (f *Field) NotEquals(n int) *PQLRowQuery

NotEquals creates a not equals query.

func (*Field) NotNull added in v0.10.0

func (f *Field) NotNull() *PQLRowQuery

NotNull creates a not equal to null query.

func (*Field) Options added in v0.10.0

func (f *Field) Options() *FieldOptions

Options returns the options set for the field. Which fields of the FieldOptions struct are actually being used depends on the field's type. *DEPRECATED*

func (*Field) Opts added in v1.3.0

func (f *Field) Opts() FieldOptions

Opts returns the options of the field

func (*Field) Range added in v0.10.0

func (f *Field) Range(rowIDOrKey interface{}, start time.Time, end time.Time) *PQLRowQuery

Range creates a Range query. Similar to Row, but only returns columns which were set with timestamps between the given start and end timestamps. *Deprecated at Pilosa 1.3*

func (*Field) Row added in v0.10.0

func (f *Field) Row(rowIDOrKey interface{}) *PQLRowQuery

Row creates a Row query. Row retrieves the indices of all the set columns in a row. It also retrieves any attributes set on that row or column.

func (*Field) RowRange added in v1.3.0

func (f *Field) RowRange(rowIDOrKey interface{}, start time.Time, end time.Time) *PQLRowQuery

RowRange creates a Row query with timestamps. Similar to Row, but only returns columns which were set with timestamps between the given start and end timestamps. *Introduced at Pilosa 1.3*

func (*Field) RowTopN added in v0.10.0

func (f *Field) RowTopN(n uint64, row *PQLRowQuery) *PQLRowQuery

RowTopN creates a TopN query with the given item count and row. This variant supports customizing the row query.

func (*Field) Rows added in v1.3.0

func (f *Field) Rows() *PQLRowsQuery

Rows creates a Rows query with defaults

func (*Field) RowsColumn added in v1.3.0

func (f *Field) RowsColumn(columnIDOrKey interface{}) *PQLRowsQuery

RowsColumn creates a Rows query with the given column ID/key

func (*Field) RowsLimit added in v1.3.0

func (f *Field) RowsLimit(limit int64) *PQLRowsQuery

RowsLimit creates a Rows query with the given limit

func (*Field) RowsLimitColumn added in v1.3.0

func (f *Field) RowsLimitColumn(limit int64, columnIDOrKey interface{}) *PQLRowsQuery

RowsLimitColumn creates a Row query with the given limit and column ID/key

func (*Field) RowsPrevious added in v1.3.0

func (f *Field) RowsPrevious(rowIDOrKey interface{}) *PQLRowsQuery

RowsPrevious creates a Rows query with the given previous row ID/key

func (*Field) RowsPreviousColumn added in v1.3.0

func (f *Field) RowsPreviousColumn(rowIDOrKey interface{}, columnIDOrKey interface{}) *PQLRowsQuery

RowsPreviousColumn creates a Rows query with the given previous row ID/key and column ID/key

func (*Field) RowsPreviousLimit added in v1.3.0

func (f *Field) RowsPreviousLimit(rowIDOrKey interface{}, limit int64) *PQLRowsQuery

RowsPreviousLimit creates a Rows query with the given previous row ID/key and limit

func (*Field) RowsPreviousLimitColumn added in v1.3.0

func (f *Field) RowsPreviousLimitColumn(rowIDOrKey interface{}, limit int64, columnIDOrKey interface{}) *PQLRowsQuery

RowsPreviousLimitColumn creates a Row query with the given previous row ID/key, limit and column ID/key

func (*Field) Set added in v0.10.0

func (f *Field) Set(rowIDOrKey, colIDOrKey interface{}) *PQLBaseQuery

Set creates a Set query. Set, assigns a value of 1 to a bit in the binary matrix, thus associating the given row in the given field with the given column.

func (*Field) SetIntValue added in v0.10.0

func (f *Field) SetIntValue(colIDOrKey interface{}, value int) *PQLBaseQuery

SetIntValue creates a Set query.

func (*Field) SetRowAttrs added in v0.10.0

func (f *Field) SetRowAttrs(rowIDOrKey interface{}, attrs map[string]interface{}) *PQLBaseQuery

SetRowAttrs creates a SetRowAttrs query. SetRowAttrs associates arbitrary key/value pairs with a row in a field. Following types are accepted: integer, float, string and boolean types.

func (*Field) SetTimestamp added in v0.10.0

func (f *Field) SetTimestamp(rowIDOrKey, colIDOrKey interface{}, timestamp time.Time) *PQLBaseQuery

SetTimestamp creates a Set query with timestamp. Set, assigns a value of 1 to a column in the binary matrix, thus associating the given row in the given field with the given column.

func (*Field) Store added in v1.2.0

func (f *Field) Store(row *PQLRowQuery, rowIDOrKey interface{}) *PQLBaseQuery

Store creates a Store call. Store writes the result of the row query to the specified row. If the row already exists, it will be replaced. The destination field must be of field type set.

func (*Field) String added in v0.10.0

func (f *Field) String() string

func (*Field) Sum added in v0.10.0

func (f *Field) Sum(row *PQLRowQuery) *PQLBaseQuery

Sum creates a sum query.

func (*Field) TopN added in v0.10.0

func (f *Field) TopN(n uint64) *PQLRowQuery

TopN creates a TopN query with the given item count. Returns the id and count of the top n rows (by count of columns) in the field.

type FieldInfo added in v0.10.0

type FieldInfo struct {
	Name string `json:"name"`
}

FieldInfo represents schema information for a field.

type FieldOption added in v0.10.0

type FieldOption func(options *FieldOptions)

FieldOption is used to pass an option to index.Field function.

func OptFieldKeys added in v0.10.0

func OptFieldKeys(keys bool) FieldOption

OptFieldKeys sets whether field uses string keys.

func OptFieldTypeBool added in v1.2.0

func OptFieldTypeBool() FieldOption

OptFieldTypeBool adds a bool field.

func OptFieldTypeInt added in v0.10.0

func OptFieldTypeInt(min int64, max int64) FieldOption

OptFieldTypeInt adds an integer field.

func OptFieldTypeMutex added in v1.2.0

func OptFieldTypeMutex(cacheType CacheType, cacheSize int) FieldOption

OptFieldTypeMutex adds a mutex field.

func OptFieldTypeSet added in v0.10.0

func OptFieldTypeSet(cacheType CacheType, cacheSize int) FieldOption

OptFieldTypeSet adds a set field. Specify CacheTypeDefault for the default cache type. Specify CacheSizeDefault for the default cache size.

func OptFieldTypeTime added in v0.10.0

func OptFieldTypeTime(quantum TimeQuantum, opts ...bool) FieldOption

OptFieldTypeTime adds a time field.

type FieldOptions added in v0.10.0

type FieldOptions struct {
	// contains filtered or unexported fields
}

FieldOptions contains options to customize Field objects and field queries.

func (FieldOptions) CacheSize added in v0.10.0

func (fo FieldOptions) CacheSize() int

CacheSize returns the cache size for a set field. Zero otherwise.

func (FieldOptions) CacheType added in v0.10.0

func (fo FieldOptions) CacheType() CacheType

CacheType returns the configured cache type for a "set" field. Empty string otherwise.

func (FieldOptions) Keys added in v1.2.0

func (fo FieldOptions) Keys() bool

Keys returns whether this field uses keys instead of IDs

func (FieldOptions) Max added in v0.10.0

func (fo FieldOptions) Max() int64

Max returns the maximum accepted value for an integer field. Zero otherwise.

func (FieldOptions) Min added in v0.10.0

func (fo FieldOptions) Min() int64

Min returns the minimum accepted value for an integer field. Zero otherwise.

func (FieldOptions) NoStandardView added in v1.2.0

func (fo FieldOptions) NoStandardView() bool

NoStandardView suppresses creating the standard view for supported field types (currently, time)

func (FieldOptions) String added in v0.10.0

func (fo FieldOptions) String() string

func (FieldOptions) TimeQuantum added in v0.10.0

func (fo FieldOptions) TimeQuantum() TimeQuantum

TimeQuantum returns the configured time quantum for a time field. Empty string otherwise.

func (FieldOptions) Type added in v0.10.0

func (fo FieldOptions) Type() FieldType

Type returns the type of the field. Currently "set", "int", or "time".

type FieldRow added in v1.3.0

type FieldRow struct {
	FieldName string `json:"field"`
	RowID     uint64 `json:"rowID"`
	RowKey    string `json:"rowKey"`
}

FieldRow represents a Group in a GroupBy call result.

type FieldType added in v0.10.0

type FieldType string

FieldType is the type of a field. See: https://www.pilosa.com/docs/latest/data-model/#field-type

const (
	// FieldTypeDefault is the default field type.
	FieldTypeDefault FieldType = ""
	// FieldTypeSet is the set field type.
	// See: https://www.pilosa.com/docs/latest/data-model/#set
	FieldTypeSet FieldType = "set"
	// FieldTypeInt is the int field type.
	// See: https://www.pilosa.com/docs/latest/data-model/#int
	FieldTypeInt FieldType = "int"
	// FieldTypeTime is the time field type.
	// See: https://www.pilosa.com/docs/latest/data-model/#time
	FieldTypeTime FieldType = "time"
	// FieldTypeMutex is the mutex field type.
	// See: https://www.pilosa.com/docs/latest/data-model/#mutex
	FieldTypeMutex FieldType = "mutex"
	// FieldTypeBool is the boolean field type.
	// See: https://www.pilosa.com/docs/latest/data-model/#boolean
	FieldTypeBool FieldType = "bool"
)

type FieldValue added in v0.7.0

type FieldValue struct {
	ColumnID  uint64
	ColumnKey string
	Value     int64
}

FieldValue represents the value for a column within a range-encoded field.

func (FieldValue) Less added in v0.9.0

func (v FieldValue) Less(other Record) bool

Less returns true if this field value sorts before the given Record.

func (FieldValue) Shard added in v0.10.0

func (v FieldValue) Shard(shardWidth uint64) uint64

Shard returns the shard for this field value.

type GroupCount added in v1.3.0

type GroupCount struct {
	Groups []FieldRow `json:"groups"`
	Count  int64      `json:"count"`
}

GroupCount contains groups and their count in a GroupBy call result.

type GroupCountResult added in v1.3.0

type GroupCountResult []GroupCount

GroupCountResult is returned from GroupBy call.

func (GroupCountResult) Changed added in v1.3.0

func (GroupCountResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (GroupCountResult) Count added in v1.3.0

func (GroupCountResult) Count() int64

Count returns the result of a Count call.

func (GroupCountResult) CountItems added in v1.3.0

func (GroupCountResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (GroupCountResult) GroupCounts added in v1.3.0

func (r GroupCountResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (GroupCountResult) Row added in v1.3.0

Row returns a RowResult.

func (GroupCountResult) RowIdentifiers added in v1.3.0

func (GroupCountResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (GroupCountResult) Type added in v1.3.0

func (GroupCountResult) Type() uint32

Type is the type of this result.

func (GroupCountResult) Value added in v1.3.0

func (GroupCountResult) Value() int64

Value returns the result of a Min, Max or Sum call.

type ImportOption added in v0.9.0

type ImportOption func(options *ImportOptions) error

ImportOption is used when running imports.

func OptImportBatchSize added in v0.9.0

func OptImportBatchSize(batchSize int) ImportOption

OptImportBatchSize is the number of records read before importing them.

func OptImportClear added in v1.2.0

func OptImportClear(clear bool) ImportOption

OptImportClear sets clear import, which clears bits instead of setting them.

func OptImportRoaring added in v1.3.0

func OptImportRoaring(enable bool) ImportOption

OptImportRoaring enables importing using roaring bitmaps which is more performant.

func OptImportSort added in v1.3.0

func OptImportSort(sorting bool) ImportOption

OptImportSort tells the importer whether or not to sort batches of records, on by default. Sorting imposes some performance cost, especially on data that's already sorted, but dramatically improves performance in pathological cases. It is enabled by default because the pathological cases are awful, and the performance hit is comparatively small, but the performance cost can be significant if you know your data is sorted.

func OptImportStatusChannel added in v0.9.0

func OptImportStatusChannel(statusChan chan<- ImportStatusUpdate) ImportOption

OptImportStatusChannel is a channel which carry import status information. Make sure to read from this channel, otherwise the import process will stall.

func OptImportThreadCount added in v0.9.0

func OptImportThreadCount(count int) ImportOption

OptImportThreadCount is the number of goroutines allocated for import.

type ImportOptions added in v0.9.0

type ImportOptions struct {
	// contains filtered or unexported fields
}

ImportOptions are the options for controlling the importer

type ImportStatusUpdate added in v0.9.0

type ImportStatusUpdate struct {
	ThreadID      int
	Shard         uint64
	ImportedCount int
	Time          time.Duration
}

ImportStatusUpdate contains the import progress information.

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index is a Pilosa index. The purpose of the Index is to represent a data namespace. You cannot perform cross-index queries. Column-level attributes are global to the Index.

func NewIndex

func NewIndex(name string) *Index

NewIndex creates an index with a name.

func (*Index) BatchQuery

func (idx *Index) BatchQuery(queries ...PQLQuery) *PQLBatchQuery

BatchQuery creates a batch query with the given queries.

func (*Index) Count

func (idx *Index) Count(row *PQLRowQuery) *PQLBaseQuery

Count creates a Count query. Returns the number of set columns in the ROW_CALL passed in.

func (*Index) Difference

func (idx *Index) Difference(rows ...*PQLRowQuery) *PQLRowQuery

Difference creates an Intersect query. Difference returns all of the columns from the first ROW_CALL argument passed to it, without the columns from each subsequent ROW_CALL.

func (*Index) Field added in v0.10.0

func (idx *Index) Field(name string, options ...FieldOption) *Field

Field creates a Field struct with the specified name and defaults.

func (*Index) Fields added in v0.10.0

func (idx *Index) Fields() map[string]*Field

Fields return a copy of the fields in this index

func (*Index) GroupBy added in v1.3.0

func (idx *Index) GroupBy(rowsQueries ...*PQLRowsQuery) *PQLBaseQuery

GroupBy creates a GroupBy query with the given Rows queries

func (*Index) GroupByFilter added in v1.3.0

func (idx *Index) GroupByFilter(filterQuery *PQLRowQuery, rowsQueries ...*PQLRowsQuery) *PQLBaseQuery

GroupByFilter creates a GroupBy query with the given filter and Rows queries

func (*Index) GroupByLimit added in v1.3.0

func (idx *Index) GroupByLimit(limit int64, rowsQueries ...*PQLRowsQuery) *PQLBaseQuery

GroupByLimit creates a GroupBy query with the given limit and Rows queries

func (*Index) GroupByLimitFilter added in v1.3.0

func (idx *Index) GroupByLimitFilter(limit int64, filterQuery *PQLRowQuery, rowsQueries ...*PQLRowsQuery) *PQLBaseQuery

GroupByLimitFilter creates a GroupBy query with the given filter and Rows queries

func (*Index) HasField added in v1.3.0

func (idx *Index) HasField(fieldName string) bool

HasFields returns true if the given field exists in the index.

func (*Index) Intersect

func (idx *Index) Intersect(rows ...*PQLRowQuery) *PQLRowQuery

Intersect creates an Intersect query. Intersect performs a logical AND on the results of each ROW_CALL query passed to it.

func (*Index) Name

func (idx *Index) Name() string

Name returns the name of this index.

func (*Index) Not added in v1.1.0

func (idx *Index) Not(row *PQLRowQuery) *PQLRowQuery

Not creates a Not query.

func (*Index) Options added in v1.2.0

func (idx *Index) Options(row *PQLRowQuery, opts ...OptionsOption) *PQLBaseQuery

Options creates an Options query.

func (*Index) Opts added in v1.3.0

func (idx *Index) Opts() IndexOptions

Opts returns the options of this index.

func (*Index) RawQuery

func (idx *Index) RawQuery(query string) *PQLBaseQuery

RawQuery creates a query with the given string. Note that the query is not validated before sending to the server.

func (*Index) SetColumnAttrs

func (idx *Index) SetColumnAttrs(colIDOrKey interface{}, attrs map[string]interface{}) *PQLBaseQuery

SetColumnAttrs creates a SetColumnAttrs query. SetColumnAttrs associates arbitrary key/value pairs with a column in an index. Following types are accepted: integer, float, string and boolean types.

func (*Index) String added in v0.8.0

func (idx *Index) String() string

func (*Index) Union

func (idx *Index) Union(rows ...*PQLRowQuery) *PQLRowQuery

Union creates a Union query. Union performs a logical OR on the results of each ROW_CALL query passed to it.

func (*Index) Xor added in v0.7.0

func (idx *Index) Xor(rows ...*PQLRowQuery) *PQLRowQuery

Xor creates an Xor query.

type IndexOption added in v0.10.0

type IndexOption func(options *IndexOptions)

IndexOption is used to pass an option to Index function.

func OptIndexKeys added in v0.10.0

func OptIndexKeys(keys bool) IndexOption

OptIndexKeys sets whether index uses string keys.

func OptIndexTrackExistence added in v1.1.0

func OptIndexTrackExistence(trackExistence bool) IndexOption

OptIndexTrackExistence enables keeping track of existence of columns.

type IndexOptions

type IndexOptions struct {
	// contains filtered or unexported fields
}

IndexOptions contains options to customize Index objects.

func (IndexOptions) Keys added in v1.2.0

func (io IndexOptions) Keys() bool

Keys return true if this index has keys.

func (IndexOptions) String

func (io IndexOptions) String() string

String serializes this index to a JSON string.

func (IndexOptions) TrackExistence added in v1.2.0

func (io IndexOptions) TrackExistence() bool

TrackExistence returns true if existence is tracked for this index.

type Info added in v1.3.0

type Info struct {
	ShardWidth       uint64 `json:"shardWidth"`       // width of each shard
	Memory           uint64 `json:"memory"`           // approximate host physical memory
	CPUType          string `json:"cpuType"`          // "brand name string" from cpuid
	CPUPhysicalCores int    `json:"CPUPhysicalCores"` // physical cores (cpuid)
	CPULogicalCores  int    `json:"CPULogicalCores"`  // logical cores cpuid
	CPUMHz           uint64 `json:"CPUMHz"`           // estimated clock speed
}

Info contains the configuration/host information from a Pilosa server.

type IntResult added in v0.9.0

type IntResult int64

IntResult is returned from Count call.

func (IntResult) Changed added in v0.9.0

func (IntResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (IntResult) Count added in v0.9.0

func (i IntResult) Count() int64

Count returns the result of a Count call.

func (IntResult) CountItems added in v0.9.0

func (IntResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (IntResult) GroupCounts added in v1.3.0

func (IntResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (IntResult) Row added in v0.10.0

func (IntResult) Row() RowResult

Row returns a RowResult.

func (IntResult) RowIdentifiers added in v1.3.0

func (IntResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (IntResult) Type added in v0.9.0

func (IntResult) Type() uint32

Type is the type of this result.

func (IntResult) Value added in v0.9.0

func (IntResult) Value() int64

Value returns the result of a Min, Max or Sum call.

type NilResult added in v0.9.0

type NilResult struct{}

NilResult is returned from calls which don't return a value, such as SetRowAttrs.

func (NilResult) Changed added in v0.9.0

func (NilResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (NilResult) Count added in v0.9.0

func (NilResult) Count() int64

Count returns the result of a Count call.

func (NilResult) CountItems added in v0.9.0

func (NilResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (NilResult) GroupCounts added in v1.3.0

func (NilResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (NilResult) Row added in v0.10.0

func (NilResult) Row() RowResult

Row returns a RowResult.

func (NilResult) RowIdentifiers added in v1.3.0

func (NilResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (NilResult) Type added in v0.9.0

func (NilResult) Type() uint32

Type is the type of this result.

func (NilResult) Value added in v0.9.0

func (NilResult) Value() int64

Value returns the result of a Min, Max or Sum call.

type NoopSpan added in v1.3.0

type NoopSpan struct{}

func (NoopSpan) BaggageItem added in v1.3.0

func (s NoopSpan) BaggageItem(restrictedKey string) string

func (NoopSpan) Context added in v1.3.0

func (s NoopSpan) Context() opentracing.SpanContext

func (NoopSpan) Finish added in v1.3.0

func (s NoopSpan) Finish()

func (NoopSpan) FinishWithOptions added in v1.3.0

func (s NoopSpan) FinishWithOptions(opts opentracing.FinishOptions)

func (NoopSpan) Log added in v1.3.0

func (s NoopSpan) Log(data opentracing.LogData)

func (NoopSpan) LogEvent added in v1.3.0

func (s NoopSpan) LogEvent(event string)

func (NoopSpan) LogEventWithPayload added in v1.3.0

func (s NoopSpan) LogEventWithPayload(event string, payload interface{})

func (NoopSpan) LogFields added in v1.3.0

func (s NoopSpan) LogFields(fields ...log.Field)

func (NoopSpan) LogKV added in v1.3.0

func (s NoopSpan) LogKV(alternatingKeyValues ...interface{})

func (NoopSpan) SetBaggageItem added in v1.3.0

func (s NoopSpan) SetBaggageItem(restrictedKey, value string) opentracing.Span

func (NoopSpan) SetOperationName added in v1.3.0

func (s NoopSpan) SetOperationName(operationName string) opentracing.Span

func (NoopSpan) SetTag added in v1.3.0

func (s NoopSpan) SetTag(key string, value interface{}) opentracing.Span

func (NoopSpan) Tracer added in v1.3.0

func (s NoopSpan) Tracer() opentracing.Tracer

type NoopTracer added in v1.3.0

type NoopTracer struct{}

func (NoopTracer) Extract added in v1.3.0

func (t NoopTracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)

func (NoopTracer) Inject added in v1.3.0

func (t NoopTracer) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error

func (NoopTracer) StartSpan added in v1.3.0

func (t NoopTracer) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span

type OptionsOption added in v1.2.0

type OptionsOption func(options *OptionsOptions)

OptionsOption is an option for Index.Options call.

func OptOptionsColumnAttrs added in v1.2.0

func OptOptionsColumnAttrs(enable bool) OptionsOption

OptOptionsColumnAttrs enables returning column attributes.

func OptOptionsExcludeColumns added in v1.2.0

func OptOptionsExcludeColumns(enable bool) OptionsOption

OptOptionsExcludeColumns enables preventing returning columns.

func OptOptionsExcludeRowAttrs added in v1.2.0

func OptOptionsExcludeRowAttrs(enable bool) OptionsOption

OptOptionsExcludeRowAttrs enables preventing returning row attributes.

func OptOptionsShards added in v1.2.0

func OptOptionsShards(shards ...uint64) OptionsOption

OptOptionsShards run the query using only the data from the given shards. By default, the entire data set (i.e. data from all shards) is used.

type OptionsOptions added in v1.2.0

type OptionsOptions struct {
	// contains filtered or unexported fields
}

OptionsOptions is used to pass an option to Option call.

type PQLBaseQuery

type PQLBaseQuery struct {
	// contains filtered or unexported fields
}

PQLBaseQuery is the base implementation for PQLQuery.

func NewPQLBaseQuery

func NewPQLBaseQuery(pql string, index *Index, err error) *PQLBaseQuery

NewPQLBaseQuery creates a new PQLQuery with the given PQL and index.

func (PQLBaseQuery) Error

func (q PQLBaseQuery) Error() error

Error returns the error or nil for this query.

func (*PQLBaseQuery) Index

func (q *PQLBaseQuery) Index() *Index

Index returns the index for this query

func (*PQLBaseQuery) Serialize added in v1.3.0

func (q *PQLBaseQuery) Serialize() SerializedQuery

type PQLBatchQuery

type PQLBatchQuery struct {
	// contains filtered or unexported fields
}

PQLBatchQuery contains a batch of PQL queries. Use Index.BatchQuery function to create an instance.

Usage:

index, err := NewIndex("repository")
stargazer, err := index.Field("stargazer")
query := repo.BatchQuery(
	stargazer.Row(5),
	stargazer.Row(15),
	repo.Union(stargazer.Row(20), stargazer.Row(25)))

func (*PQLBatchQuery) Add

func (q *PQLBatchQuery) Add(query PQLQuery)

Add adds a query to the batch.

func (*PQLBatchQuery) Error

func (q *PQLBatchQuery) Error() error

func (*PQLBatchQuery) Index

func (q *PQLBatchQuery) Index() *Index

Index returns the index for this query.

func (*PQLBatchQuery) Serialize added in v1.3.0

func (q *PQLBatchQuery) Serialize() SerializedQuery

type PQLQuery

type PQLQuery interface {
	Index() *Index
	Serialize() SerializedQuery
	Error() error
}

PQLQuery is an interface for PQL queries.

type PQLRowQuery added in v0.10.0

type PQLRowQuery struct {
	// contains filtered or unexported fields
}

PQLRowQuery is the return type for row queries.

func NewPQLRowQuery added in v0.10.0

func NewPQLRowQuery(pql string, index *Index, err error) *PQLRowQuery

NewPQLRowQuery creates a new PqlRowQuery.

func (PQLRowQuery) Error added in v0.10.0

func (q PQLRowQuery) Error() error

Error returns the error or nil for this query.

func (*PQLRowQuery) Index added in v0.10.0

func (q *PQLRowQuery) Index() *Index

Index returns the index for this query/

func (*PQLRowQuery) Serialize added in v1.3.0

func (q *PQLRowQuery) Serialize() SerializedQuery

type PQLRowsQuery added in v1.3.0

type PQLRowsQuery struct {
	// contains filtered or unexported fields
}

PQLRowsQuery is the return type for Rows calls.

func NewPQLRowsQuery added in v1.3.0

func NewPQLRowsQuery(pql string, index *Index, err error) *PQLRowsQuery

NewPQLRowsQuery creates a new PQLRowsQuery.

func (PQLRowsQuery) Error added in v1.3.0

func (q PQLRowsQuery) Error() error

Error returns the error or nil for this query.

func (*PQLRowsQuery) Index added in v1.3.0

func (q *PQLRowsQuery) Index() *Index

Index returns the index for this query/

func (*PQLRowsQuery) Serialize added in v1.3.0

func (q *PQLRowsQuery) Serialize() SerializedQuery

type QueryOption added in v0.8.0

type QueryOption func(options *QueryOptions) error

QueryOption is used when using options with a client.Query,

func OptQueryColumnAttrs added in v0.9.0

func OptQueryColumnAttrs(enable bool) QueryOption

OptQueryColumnAttrs enables returning column attributes in the result.

func OptQueryExcludeAttrs added in v0.9.0

func OptQueryExcludeAttrs(enable bool) QueryOption

OptQueryExcludeAttrs enables discarding attributes from a result,

func OptQueryExcludeColumns added in v0.10.0

func OptQueryExcludeColumns(enable bool) QueryOption

OptQueryExcludeColumns enables discarding columns from a result,

func OptQueryShards added in v0.10.0

func OptQueryShards(shards ...uint64) QueryOption

OptQueryShards restricts the set of shards on which a query operates.

type QueryOptions

type QueryOptions struct {
	// Shards restricts query to a subset of shards. Queries all shards if nil.
	Shards []uint64
	// ColumnAttrs enables returning columns in the query response.
	ColumnAttrs bool
	// ExcludeRowAttrs inhibits returning attributes
	ExcludeRowAttrs bool
	// ExcludeColumns inhibits returning columns
	ExcludeColumns bool
}

QueryOptions contains options to customize the Query function.

type QueryResponse

type QueryResponse struct {
	ResultList   []QueryResult `json:"results,omitempty"`
	ColumnList   []ColumnItem  `json:"columns,omitempty"`
	ErrorMessage string        `json:"error-message,omitempty"`
	Success      bool          `json:"success,omitempty"`
}

QueryResponse represents the response from a Pilosa query.

func (*QueryResponse) Column

func (qr *QueryResponse) Column() ColumnItem

Column returns the attributes for first column. *DEPRECATED*

func (*QueryResponse) ColumnAttrs added in v1.3.0

func (qr *QueryResponse) ColumnAttrs() []ColumnItem

ColumnAttrs returns all column attributes in the response.

func (*QueryResponse) Columns

func (qr *QueryResponse) Columns() []ColumnItem

Columns returns all column attributes in the response. *DEPRECATED*

func (*QueryResponse) Result

func (qr *QueryResponse) Result() QueryResult

Result returns the first result or nil.

func (*QueryResponse) Results

func (qr *QueryResponse) Results() []QueryResult

Results returns all results in the response.

type QueryResult

type QueryResult interface {
	Type() uint32
	Row() RowResult
	CountItems() []CountResultItem
	Count() int64
	Value() int64
	Changed() bool
	GroupCounts() []GroupCount
	RowIdentifiers() RowIdentifiersResult
}

QueryResult represents one of the results in the response.

type Record added in v0.9.0

type Record interface {
	Shard(shardWidth uint64) uint64
	Less(other Record) bool
}

Record is a Column or a FieldValue.

type RecordIterator added in v0.9.0

type RecordIterator interface {
	NextRecord() (Record, error)
}

RecordIterator is an iterator for a record.

type RowIdentifiersResult added in v1.3.0

type RowIdentifiersResult struct {
	IDs  []uint64 `json:"ids"`
	Keys []string `json:"keys,omitempty"`
}

RowIdentifiersResult is returned from a Rows call.

func (RowIdentifiersResult) Changed added in v1.3.0

func (RowIdentifiersResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (RowIdentifiersResult) Count added in v1.3.0

func (RowIdentifiersResult) Count() int64

Count returns the result of a Count call.

func (RowIdentifiersResult) CountItems added in v1.3.0

func (RowIdentifiersResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (RowIdentifiersResult) GroupCounts added in v1.3.0

func (RowIdentifiersResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (RowIdentifiersResult) Row added in v1.3.0

Row returns a RowResult.

func (RowIdentifiersResult) RowIdentifiers added in v1.3.0

func (r RowIdentifiersResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (RowIdentifiersResult) Type added in v1.3.0

Type is the type of this result.

func (RowIdentifiersResult) Value added in v1.3.0

func (RowIdentifiersResult) Value() int64

Value returns the result of a Min, Max or Sum call.

type RowResult added in v0.10.0

type RowResult struct {
	Attributes map[string]interface{} `json:"attrs"`
	Columns    []uint64               `json:"columns"`
	Keys       []string               `json:"keys"`
}

RowResult represents a result from Row, Union, Intersect, Difference and Range PQL calls.

func (RowResult) Changed added in v0.10.0

func (RowResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (RowResult) Count added in v0.10.0

func (RowResult) Count() int64

Count returns the result of a Count call.

func (RowResult) CountItems added in v0.10.0

func (RowResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (RowResult) GroupCounts added in v1.3.0

func (RowResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (RowResult) MarshalJSON added in v0.10.0

func (b RowResult) MarshalJSON() ([]byte, error)

MarshalJSON serializes this row result.

func (RowResult) Row added in v0.10.0

func (b RowResult) Row() RowResult

Row returns a RowResult.

func (RowResult) RowIdentifiers added in v1.3.0

func (RowResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (RowResult) Type added in v0.10.0

func (RowResult) Type() uint32

Type is the type of this result.

func (RowResult) Value added in v0.10.0

func (RowResult) Value() int64

Value returns the result of a Min, Max or Sum call.

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema contains the index properties

func NewSchema added in v0.5.0

func NewSchema() *Schema

NewSchema creates a new Schema

func (*Schema) HasIndex added in v1.3.0

func (s *Schema) HasIndex(indexName string) bool

HasIndex returns true if the given index is in the schema.

func (*Schema) Index added in v0.5.0

func (s *Schema) Index(name string, options ...IndexOption) *Index

Index returns an index with a name.

func (*Schema) Indexes

func (s *Schema) Indexes() map[string]*Index

Indexes return a copy of the indexes in this schema

func (*Schema) String added in v0.8.0

func (s *Schema) String() string

type SchemaField added in v1.1.0

type SchemaField struct {
	Name    string        `json:"name"`
	Options SchemaOptions `json:"options"`
}

SchemaField contains field information.

type SchemaIndex added in v1.1.0

type SchemaIndex struct {
	Name       string        `json:"name"`
	Options    SchemaOptions `json:"options"`
	Fields     []SchemaField `json:"fields"`
	Shards     []uint64      `json:"shards"`
	ShardWidth uint64        `json:"shardWidth"`
}

SchemaIndex contains index information.

type SchemaInfo added in v0.9.0

type SchemaInfo struct {
	Indexes []SchemaIndex `json:"indexes"`
}

SchemaInfo contains the indexes.

type SchemaOptions added in v1.1.0

type SchemaOptions struct {
	FieldType      FieldType `json:"type"`
	CacheType      string    `json:"cacheType"`
	CacheSize      uint      `json:"cacheSize"`
	TimeQuantum    string    `json:"timeQuantum"`
	Min            int64     `json:"min"`
	Max            int64     `json:"max"`
	Keys           bool      `json:"keys"`
	NoStandardView bool      `json:"noStandardView"`
	TrackExistence bool      `json:"trackExistence"`
}

SchemaOptions contains options for a field or an index.

type SerializedQuery added in v1.3.0

type SerializedQuery interface {
	String() string
	HasWriteKeys() bool
}

type Status added in v0.5.0

type Status struct {
	Nodes   []StatusNode `json:"nodes"`
	State   string       `json:"state"`
	LocalID string       `json:"localID"`
	// contains filtered or unexported fields
}

Status contains the status information from a Pilosa server.

type StatusNode added in v0.5.0

type StatusNode struct {
	ID            string    `json:"id"`
	URI           StatusURI `json:"uri"`
	IsCoordinator bool      `json:"isCoordinator"`
}

StatusNode contains information about a node in the cluster.

type StatusURI added in v1.1.0

type StatusURI struct {
	Scheme string `json:"scheme"`
	Host   string `json:"host"`
	Port   uint16 `json:"port"`
}

StatusURI contains node information.

type TimeQuantum

type TimeQuantum string

TimeQuantum type represents valid time quantum values time fields.

const (
	TimeQuantumNone             TimeQuantum = ""
	TimeQuantumYear             TimeQuantum = "Y"
	TimeQuantumMonth            TimeQuantum = "M"
	TimeQuantumDay              TimeQuantum = "D"
	TimeQuantumHour             TimeQuantum = "H"
	TimeQuantumYearMonth        TimeQuantum = "YM"
	TimeQuantumMonthDay         TimeQuantum = "MD"
	TimeQuantumDayHour          TimeQuantum = "DH"
	TimeQuantumYearMonthDay     TimeQuantum = "YMD"
	TimeQuantumMonthDayHour     TimeQuantum = "MDH"
	TimeQuantumYearMonthDayHour TimeQuantum = "YMDH"
)

TimeQuantum constants

type TopNResult added in v0.9.0

type TopNResult []CountResultItem

TopNResult is returned from TopN call.

func (TopNResult) Changed added in v0.9.0

func (TopNResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (TopNResult) Count added in v0.9.0

func (TopNResult) Count() int64

Count returns the result of a Count call.

func (TopNResult) CountItems added in v0.9.0

func (t TopNResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (TopNResult) GroupCounts added in v1.3.0

func (TopNResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (TopNResult) Row added in v0.10.0

func (TopNResult) Row() RowResult

Row returns a RowResult.

func (TopNResult) RowIdentifiers added in v1.3.0

func (TopNResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (TopNResult) Type added in v0.9.0

func (TopNResult) Type() uint32

Type is the type of this result.

func (TopNResult) Value added in v0.9.0

func (TopNResult) Value() int64

Value returns the result of a Min, Max or Sum call.

type URI

type URI struct {
	// contains filtered or unexported fields
}

URI represents a Pilosa URI. A Pilosa URI consists of three parts: 1) Scheme: Protocol of the URI. Default: http. 2) Host: Hostname or IP URI. Default: localhost. IPv6 addresses should be written in brackets, e.g., `[fd42:4201:f86b:7e09:216:3eff:fefa:ed80]`. 3) Port: Port of the URI. Default: 10101.

All parts of the URI are optional. The following are equivalent:

http://localhost:10101
http://localhost
http://:10101
localhost:10101
localhost
:10101

func DefaultURI

func DefaultURI() *URI

DefaultURI creates and returns the default URI.

func NewURIFromAddress

func NewURIFromAddress(address string) (*URI, error)

NewURIFromAddress parses the passed address and returns a URI.

func NewURIFromHostPort

func NewURIFromHostPort(host string, port uint16) (*URI, error)

NewURIFromHostPort returns a URI with specified host and port.

func URIFromAddress added in v0.8.0

func URIFromAddress(host string) *URI

URIFromAddress creates a URI from the given address.

func (URI) Equals

func (u URI) Equals(other *URI) bool

Equals returns true if the checked URI is equivalent to this URI.

func (*URI) Error added in v0.8.0

func (u *URI) Error() error

Error returns the error if this URI has one.

func (*URI) Host

func (u *URI) Host() string

Host returns the host of this URI.

func (*URI) HostPort added in v0.8.0

func (u *URI) HostPort() string

HostPort returns `Host:Port`

func (*URI) Normalize

func (u *URI) Normalize() string

Normalize returns the address in a form usable by a HTTP client.

func (*URI) Port

func (u *URI) Port() uint16

Port returns the port of this URI.

func (*URI) Scheme

func (u *URI) Scheme() string

Scheme returns the scheme of this URI.

func (*URI) SetHost added in v0.8.0

func (u *URI) SetHost(host string) error

SetHost sets the host of this URI.

func (*URI) SetPort added in v0.8.0

func (u *URI) SetPort(port uint16)

SetPort sets the port of this URI.

func (*URI) SetScheme added in v0.8.0

func (u *URI) SetScheme(scheme string) error

SetScheme sets the scheme of this URI.

func (*URI) Valid added in v0.8.0

func (u *URI) Valid() bool

Valid returns true if this is a valid URI.

type ValCountResult added in v0.9.0

type ValCountResult struct {
	Val int64 `json:"val"`
	Cnt int64 `json:"count"`
}

ValCountResult is returned from Min, Max and Sum calls.

func (ValCountResult) Changed added in v0.9.0

func (ValCountResult) Changed() bool

Changed returns whether the corresponding Set or Clear call changed the value of a bit.

func (ValCountResult) Count added in v0.9.0

func (c ValCountResult) Count() int64

Count returns the result of a Count call.

func (ValCountResult) CountItems added in v0.9.0

func (ValCountResult) CountItems() []CountResultItem

CountItems returns a CountResultItem slice.

func (ValCountResult) GroupCounts added in v1.3.0

func (ValCountResult) GroupCounts() []GroupCount

GroupCounts returns the result of a GroupBy call.

func (ValCountResult) Row added in v0.10.0

func (ValCountResult) Row() RowResult

Row returns a RowResult.

func (ValCountResult) RowIdentifiers added in v1.3.0

func (ValCountResult) RowIdentifiers() RowIdentifiersResult

RowIdentifiers returns the result of a Rows call.

func (ValCountResult) Type added in v0.9.0

func (ValCountResult) Type() uint32

Type is the type of this result.

func (ValCountResult) Value added in v0.9.0

func (c ValCountResult) Value() int64

Value returns the result of a Min, Max or Sum call.

Directories

Path Synopsis
Package gopilosa_pbuf is a generated protocol buffer package.
Package gopilosa_pbuf is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL