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", nil)
if err != nil {
panic(err)
}
// Create a Frame instance
stargazer, err := index.Frame("stargazer", nil)
if err != nil {
panic(err)
}
// Sync the schema with the server-side, so non-existing indexes/frames are created on the server-side.
err = client.SyncSchema(schema)
if err != nil {
panic(err)
}
// Execute a query
response, err := client.Query(stargazer.Bitmap(5), nil)
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 ¶
- Variables
- func ValidFrameName(name string) bool
- func ValidIndexName(name string) bool
- func ValidLabel(label string) bool
- type Bit
- type BitIterator
- type BitmapResult
- type CSVBitIterator
- type CSVValueIterator
- type CacheType
- type Client
- func DefaultClient() *Client
- func NewClient(addrUriOrCluster interface{}, options ...ClientOption) (*Client, error)
- func NewClientFromAddresses(addresses []string, options *ClientOptions) (*Client, error)
- func NewClientWithCluster(cluster *Cluster, options *ClientOptions) *Client
- func NewClientWithURI(uri *URI) *Client
- func (c *Client) CreateFrame(frame *Frame) error
- func (c *Client) CreateIndex(index *Index) error
- func (c *Client) CreateIntField(frame *Frame, name string, min int, max int) error
- func (c *Client) DeleteField(frame *Frame, name string) error
- func (c *Client) DeleteFrame(frame *Frame) error
- func (c *Client) DeleteIndex(index *Index) error
- func (c *Client) EnsureFrame(frame *Frame) error
- func (c *Client) EnsureIndex(index *Index) error
- func (c *Client) ExportFrame(frame *Frame, view string) (BitIterator, error)
- func (c *Client) HttpRequest(method string, path string, data []byte, headers map[string]string) (*http.Response, []byte, error)
- func (c *Client) ImportFrame(frame *Frame, bitIterator BitIterator, batchSize uint) error
- func (c *Client) ImportValueFrame(frame *Frame, field string, valueIterator ValueIterator, batchSize uint) error
- func (c *Client) Query(query PQLQuery, options ...interface{}) (*QueryResponse, error)
- func (c *Client) Schema() (*Schema, error)
- func (c *Client) SyncSchema(schema *Schema) error
- func (c *Client) Views(frame *Frame) ([]string, error)
- type ClientOption
- type ClientOptions
- type Cluster
- type ColumnItem
- type CountResultItem
- type Error
- type FieldValue
- type Frame
- func (f *Frame) Bitmap(rowID uint64) *PQLBitmapQuery
- func (f *Frame) BitmapTopN(n uint64, bitmap *PQLBitmapQuery) *PQLBitmapQuery
- func (f *Frame) ClearBit(rowID uint64, columnID uint64) *PQLBaseQuery
- func (f *Frame) Field(name string) *RangeField
- func (f *Frame) Fields() map[string]*RangeField
- func (f *Frame) FilterFieldTopN(n uint64, bitmap *PQLBitmapQuery, field string, values ...interface{}) *PQLBitmapQuery
- func (f *Frame) InverseBitmap(columnID uint64) *PQLBaseQuery
- func (f *Frame) InverseBitmapTopN(n uint64, bitmap *PQLBitmapQuery) *PQLBitmapQuery
- func (f *Frame) InverseFilterFieldTopN(n uint64, bitmap *PQLBitmapQuery, field string, values ...interface{}) *PQLBitmapQuery
- func (f *Frame) InverseRange(columnID uint64, start time.Time, end time.Time) *PQLBitmapQuery
- func (f *Frame) InverseTopN(n uint64) *PQLBitmapQuery
- func (f *Frame) Name() string
- func (f *Frame) Range(rowID uint64, start time.Time, end time.Time) *PQLBitmapQuery
- func (f *Frame) SetBit(rowID uint64, columnID uint64) *PQLBaseQuery
- func (f *Frame) SetBitTimestamp(rowID uint64, columnID uint64, timestamp time.Time) *PQLBaseQuery
- func (f *Frame) SetIntFieldValue(columnID uint64, field string, value int) *PQLBaseQuery
- func (f *Frame) SetRowAttrs(rowID uint64, attrs map[string]interface{}) *PQLBaseQuery
- func (f *Frame) String() string
- func (f *Frame) Sum(bitmap *PQLBitmapQuery, field string) *PQLBaseQuery
- func (f *Frame) TopN(n uint64) *PQLBitmapQuery
- type FrameInfo
- type FrameOption
- type FrameOptions
- type Index
- func (idx *Index) BatchQuery(queries ...PQLQuery) *PQLBatchQuery
- func (idx *Index) Count(bitmap *PQLBitmapQuery) *PQLBaseQuery
- func (idx *Index) Difference(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
- func (idx *Index) Frame(name string, options ...interface{}) (*Frame, error)
- func (idx *Index) Frames() map[string]*Frame
- func (idx *Index) Intersect(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
- func (idx *Index) Name() string
- func (idx *Index) RawQuery(query string) *PQLBaseQuery
- func (idx *Index) SetColumnAttrs(columnID uint64, attrs map[string]interface{}) *PQLBaseQuery
- func (idx *Index) String() string
- func (idx *Index) Union(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
- func (idx *Index) Xor(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
- type IndexOptions
- type PQLBaseQuery
- type PQLBatchQuery
- type PQLBitmapQuery
- type PQLQuery
- type QueryOption
- type QueryOptions
- type QueryResponse
- type QueryResult
- type RangeField
- func (field *RangeField) Between(a int, b int) *PQLBitmapQuery
- func (field *RangeField) GT(n int) *PQLBitmapQuery
- func (field *RangeField) GTE(n int) *PQLBitmapQuery
- func (field *RangeField) LT(n int) *PQLBitmapQuery
- func (field *RangeField) LTE(n int) *PQLBitmapQuery
- func (field *RangeField) SetIntValue(columnID uint64, value int) *PQLBaseQuery
- func (field *RangeField) Sum(bitmap *PQLBitmapQuery) *PQLBaseQuery
- type Schema
- type Status
- type StatusField
- type StatusFrame
- type StatusIndex
- type StatusMeta
- type StatusNode
- type TimeQuantum
- type URI
- func (u URI) Equals(other *URI) bool
- func (u *URI) Error() error
- func (u *URI) Host() string
- func (u *URI) HostPort() string
- func (u *URI) Normalize() string
- func (u *URI) Port() uint16
- func (u *URI) Scheme() string
- func (u *URI) SetHost(host string) error
- func (u *URI) SetPort(port uint16)
- func (u *URI) SetScheme(scheme string) error
- func (u *URI) Valid() bool
- type ValueIterator
Constants ¶
This section is empty.
Variables ¶
var ( ErrorEmptyCluster = NewError("No usable addresses in the cluster") ErrorIndexExists = NewError("Index exists") ErrorFrameExists = NewError("Frame exists") ErrorInvalidIndexName = NewError("Invalid index name") ErrorInvalidFrameName = NewError("Invalid frame name") ErrorInvalidLabel = NewError("Invalid label") ErrorTriedMaxHosts = NewError("Tried max hosts, still failing") )
Predefined Pilosa errors. Deprecated. Use Err forms instead.
var ( ErrEmptyCluster = NewError("No usable addresses in the cluster") ErrIndexExists = NewError("Index exists") ErrFrameExists = NewError("Frame exists") ErrInvalidIndexName = NewError("Invalid index name") ErrInvalidFrameName = NewError("Invalid frame name") ErrInvalidLabel = NewError("Invalid label") 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") ErrInvalidFrameOption = NewError("Invalid frame option") )
Predefined Pilosa errors.
Functions ¶
func ValidFrameName ¶
ValidFrameName returns true if the given frame name is valid, otherwise false.
func ValidIndexName ¶
ValidIndexName returns true if the given index name is valid, otherwise false.
func ValidLabel ¶
ValidLabel returns true if the given label is valid, otherwise false.
Types ¶
type BitIterator ¶ added in v0.5.0
BitIterator structs return bits one by one.
type BitmapResult ¶
BitmapResult represents a result from Bitmap, Union, Intersect, Difference and Range PQL calls.
type CSVBitIterator ¶ added in v0.5.0
type CSVBitIterator struct {
// contains filtered or unexported fields
}
CSVBitIterator reads bits from a Reader. Each line should contain a single bit in the following form: rowID,columnID[,timestamp]
func NewCSVBitIterator ¶ added in v0.5.0
func NewCSVBitIterator(reader io.Reader) *CSVBitIterator
NewCSVBitIterator creates a CSVBitIterator from a Reader.
func NewCSVBitIteratorWithTimestampFormat ¶ added in v0.7.0
func NewCSVBitIteratorWithTimestampFormat(reader io.Reader, timestampFormat string) *CSVBitIterator
NewCSVBitIteratorWithTimestampFormat creates a CSVBitIterator from a Reader with a custom timestamp format.
func (*CSVBitIterator) NextBit ¶ added in v0.5.0
func (c *CSVBitIterator) NextBit() (Bit, error)
NextBit iterates on lines of a Reader. Returns io.EOF on end of iteration.
type CSVValueIterator ¶ added in v0.7.0
type CSVValueIterator struct {
// contains filtered or unexported fields
}
CSVValueIterator reads field values from a Reader. Each line should contain a single field value in the following form: columnID,value
func NewCSVValueIterator ¶ added in v0.7.0
func NewCSVValueIterator(reader io.Reader) *CSVValueIterator
NewCSVValueIterator creates a CSVValueIterator from a Reader.
func (*CSVValueIterator) NextValue ¶ added in v0.7.0
func (c *CSVValueIterator) NextValue() (FieldValue, error)
NextValue iterates on lines of a Reader. Returns io.EOF on end of iteration.
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 NewClientFromAddresses ¶ added in v0.5.0
func NewClientFromAddresses(addresses []string, options *ClientOptions) (*Client, error)
NewClientFromAddresses creates a client for a cluster specified by `hosts`. Each string in `hosts` is the string representation of a URI. E.G node0.pilosa.com:10101
func NewClientWithCluster ¶
func NewClientWithCluster(cluster *Cluster, options *ClientOptions) *Client
NewClientWithCluster creates a client with the given cluster and options. Pass nil for default options.
func NewClientWithURI ¶
NewClientWithURI creates a client with the given server address.
func (*Client) CreateFrame ¶
CreateFrame creates a frame on the server using the given Frame struct.
func (*Client) CreateIndex ¶
CreateIndex creates an index on the server using the given Index struct.
func (*Client) CreateIntField ¶ added in v0.7.0
CreateIntField creates an integer range field. *Experimental*: This feature may be removed or its interface may be modified in the future.
func (*Client) DeleteField ¶ added in v0.7.0
DeleteField delete a range field. *Experimental*: This feature may be removed or its interface may be modified in the future.
func (*Client) DeleteFrame ¶
DeleteFrame deletes a frame on the server.
func (*Client) DeleteIndex ¶
DeleteIndex deletes an index on the server.
func (*Client) EnsureFrame ¶
EnsureFrame creates a frame on the server if it doesn't exists.
func (*Client) EnsureIndex ¶
EnsureIndex creates an index on the server if it does not exist.
func (*Client) ExportFrame ¶ added in v0.5.0
func (c *Client) ExportFrame(frame *Frame, view string) (BitIterator, error)
ExportFrame exports bits for a frame.
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) ImportFrame ¶ added in v0.5.0
func (c *Client) ImportFrame(frame *Frame, bitIterator BitIterator, batchSize uint) error
ImportFrame imports bits from the given CSV iterator.
func (*Client) ImportValueFrame ¶ added in v0.7.0
func (c *Client) ImportValueFrame(frame *Frame, field string, valueIterator ValueIterator, batchSize uint) error
ImportValueFrame imports field values from the given CSV iterator.
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) SyncSchema ¶ added in v0.5.0
SyncSchema updates a schema with the indexes and frames on the server and creates the indexes and frames in the schema on the server side. This function does not delete indexes and the frames 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 ConnectTimeout ¶ added in v0.8.0
func ConnectTimeout(timeout time.Duration) ClientOption
ConnectTimeout is the maximum time to connect in nanoseconds.
func PoolSizePerRoute ¶ added in v0.8.0
func PoolSizePerRoute(size int) ClientOption
PoolSizePerRoute is the maximum number of active connections in the pool to a host.
func SocketTimeout ¶ added in v0.8.0
func SocketTimeout(timeout time.Duration) ClientOption
SocketTimeout is the maximum idle socket time in nanoseconds
func TLSConfig ¶ added in v0.8.0
func TLSConfig(config *tls.Config) ClientOption
TLSConfig contains the TLS configuration.
func TotalPoolSize ¶ added in v0.8.0
func TotalPoolSize(size int) ClientOption
TotalPoolSize is the maximum number of connections in the pool.
type ClientOptions ¶
type ClientOptions struct {
SocketTimeout time.Duration
ConnectTimeout time.Duration
PoolSizePerRoute int
TotalPoolSize int
TLSConfig *tls.Config
}
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 NewClusterWithHost ¶
NewClusterWithHost returns a cluster with the given URIs.
func (*Cluster) RemoveHost ¶
RemoveHost black lists the host with the given URI from the cluster.
type ColumnItem ¶
type ColumnItem struct {
ID uint64 `json:"id,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 ¶
CountResultItem represents a result from TopN call.
func (*CountResultItem) String ¶ added in v0.8.0
func (c *CountResultItem) String() string
type FieldValue ¶ added in v0.7.0
FieldValue represents the value for a column within a range-encoded frame.
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame structs are used to segment and define different functional characteristics within your entire index. You can think of a Frame as a table-like data partition within your Index. Row-level attributes are namespaced at the Frame level.
func (*Frame) Bitmap ¶
func (f *Frame) Bitmap(rowID uint64) *PQLBitmapQuery
Bitmap creates a bitmap query using the row label. Bitmap retrieves the indices of all the set bits in a row or column based on whether the row label or column label is given in the query. It also retrieves any attributes set on that row or column.
func (*Frame) BitmapTopN ¶
func (f *Frame) BitmapTopN(n uint64, bitmap *PQLBitmapQuery) *PQLBitmapQuery
BitmapTopN creates a TopN query with the given item count and bitmap. This variant supports customizing the bitmap query.
func (*Frame) ClearBit ¶
func (f *Frame) ClearBit(rowID uint64, columnID uint64) *PQLBaseQuery
ClearBit creates a ClearBit query. ClearBit, assigns a value of 0 to a bit in the binary matrix, thus disassociating the given row in the given frame from the given column.
func (*Frame) Field ¶ added in v0.7.0
func (f *Frame) Field(name string) *RangeField
Field returns a field to operate on.
func (*Frame) Fields ¶ added in v0.8.0
func (f *Frame) Fields() map[string]*RangeField
Fields return a copy of the fields in this frame
func (*Frame) FilterFieldTopN ¶
func (f *Frame) FilterFieldTopN(n uint64, bitmap *PQLBitmapQuery, field string, values ...interface{}) *PQLBitmapQuery
FilterFieldTopN creates a TopN query with the given item count, bitmap, field and the filter for that field The field and filters arguments work together to only return Bitmaps which have the attribute specified by field with one of the values specified in filters.
func (*Frame) InverseBitmap ¶
func (f *Frame) InverseBitmap(columnID uint64) *PQLBaseQuery
InverseBitmap creates a bitmap query using the column label. Bitmap retrieves the indices of all the set bits in a row or column based on whether the row label or column label is given in the query. It also retrieves any attributes set on that row or column.
func (*Frame) InverseBitmapTopN ¶ added in v0.4.0
func (f *Frame) InverseBitmapTopN(n uint64, bitmap *PQLBitmapQuery) *PQLBitmapQuery
InverseBitmapTopN creates a TopN query with the given item count and bitmap. This variant supports customizing the bitmap query and sets inverse=true.
func (*Frame) InverseFilterFieldTopN ¶ added in v0.4.0
func (f *Frame) InverseFilterFieldTopN(n uint64, bitmap *PQLBitmapQuery, field string, values ...interface{}) *PQLBitmapQuery
InverseFilterFieldTopN creates a TopN query with the given item count, bitmap, field and the filter for that field The field and filters arguments work together to only return Bitmaps which have the attribute specified by field with one of the values specified in filters. This variant sets inverse=true.
func (*Frame) InverseRange ¶ added in v0.4.0
InverseRange creates a Range query. Similar to Bitmap, but only returns bits which were set with timestamps between the given start and end timestamps.
func (*Frame) InverseTopN ¶ added in v0.4.0
func (f *Frame) InverseTopN(n uint64) *PQLBitmapQuery
InverseTopN creates a TopN query with the given item count. Returns the id and count of the top n bitmaps (by count of bits) in the frame. This variant sets inverse=true
func (*Frame) Range ¶
Range creates a Range query. Similar to Bitmap, but only returns bits which were set with timestamps between the given start and end timestamps.
func (*Frame) SetBit ¶
func (f *Frame) SetBit(rowID uint64, columnID uint64) *PQLBaseQuery
SetBit creates a SetBit query. SetBit, assigns a value of 1 to a bit in the binary matrix, thus associating the given row in the given frame with the given column.
func (*Frame) SetBitTimestamp ¶
SetBitTimestamp creates a SetBit query with timestamp. SetBit, assigns a value of 1 to a bit in the binary matrix, thus associating the given row in the given frame with the given column.
func (*Frame) SetIntFieldValue ¶ added in v0.7.0
func (f *Frame) SetIntFieldValue(columnID uint64, field string, value int) *PQLBaseQuery
SetIntFieldValue creates a SetFieldValue query. *Deprecated* Use `frame.SetIntValue(columnID, value)` instead.
func (*Frame) SetRowAttrs ¶
func (f *Frame) SetRowAttrs(rowID uint64, attrs map[string]interface{}) *PQLBaseQuery
SetRowAttrs creates a SetRowAttrs query. SetRowAttrs associates arbitrary key/value pairs with a row in a frame. Following types are accepted: integer, float, string and boolean types.
func (*Frame) Sum ¶ added in v0.7.0
func (f *Frame) Sum(bitmap *PQLBitmapQuery, field string) *PQLBaseQuery
Sum creates a Sum query. The corresponding frame should include the field in its options. *Deprecated* Use `frame.Sum(bitmap)` instead.
func (*Frame) TopN ¶
func (f *Frame) TopN(n uint64) *PQLBitmapQuery
TopN creates a TopN query with the given item count. Returns the id and count of the top n bitmaps (by count of bits) in the frame.
type FrameInfo ¶
type FrameInfo struct {
Name string `json:"name"`
}
FrameInfo represents schema information for a frame.
type FrameOption ¶ added in v0.8.0
type FrameOption func(options *FrameOptions) error
FrameOption is used to pass an option to index.Frame function.
func CacheSize ¶ added in v0.8.0
func CacheSize(size uint) FrameOption
CacheSize sets the cache size.
func IntField ¶ added in v0.8.0
func IntField(name string, min int, max int) FrameOption
IntField adds an integer field to the frame.
func InverseEnabled ¶ added in v0.8.0
func InverseEnabled(enabled bool) FrameOption
InverseEnabled enables inverse frame.
func RangeEnabled ¶ added in v0.8.0
func RangeEnabled(enabled bool) FrameOption
RangeEnabled enables range encoding for a frame.
type FrameOptions ¶
type FrameOptions struct {
RowLabel string
// If a Frame has a time quantum, then Views are generated for each of the defined time segments.
TimeQuantum TimeQuantum
// Enables inverted frames
InverseEnabled bool
CacheType CacheType
CacheSize uint
RangeEnabled bool
// contains filtered or unexported fields
}
FrameOptions contains options to customize Frame objects and frame queries. *Deprecation*: `RowLabel` field is deprecated and will be removed in a future release.
func (*FrameOptions) AddIntField ¶ added in v0.7.0
func (fo *FrameOptions) AddIntField(name string, min int, max int) error
AddIntField adds an integer field to the frame options
func (FrameOptions) String ¶
func (fo FrameOptions) String() string
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, options *IndexOptions) (*Index, error)
NewIndex creates an index with a name and options. Pass nil for default options.
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(bitmap *PQLBitmapQuery) *PQLBaseQuery
Count creates a Count query. Returns the number of set bits in the BITMAP_CALL passed in.
func (*Index) Difference ¶
func (idx *Index) Difference(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
Difference creates an Intersect query. Difference returns all of the bits from the first BITMAP_CALL argument passed to it, without the bits from each subsequent BITMAP_CALL.
func (*Index) Intersect ¶
func (idx *Index) Intersect(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
Intersect creates an Intersect query. Intersect performs a logical AND on the results of each BITMAP_CALL query passed to it.
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(columnID uint64, 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) Union ¶
func (idx *Index) Union(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
Union creates a Union query. Union performs a logical OR on the results of each BITMAP_CALL query passed to it.
func (*Index) Xor ¶ added in v0.7.0
func (idx *Index) Xor(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
Xor creates an Xor query.
type IndexOptions ¶
type IndexOptions struct {
ColumnLabel string
TimeQuantum TimeQuantum
}
IndexOptions contains options to customize Index structs and column queries. *Deprecation*: `ColumnLabel` field is deprecated and will be removed in a future release.
func (IndexOptions) String ¶
func (options IndexOptions) String() string
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
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", nil)
stargazer, err := index.Frame("stargazer", nil)
query := repo.BatchQuery(
stargazer.Bitmap(5),
stargazer.Bitmap(15),
repo.Union(stargazer.Bitmap(20), stargazer.Bitmap(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.
type PQLBitmapQuery ¶
type PQLBitmapQuery struct {
// contains filtered or unexported fields
}
PQLBitmapQuery is the return type for bitmap queries.
func NewPQLBitmapQuery ¶
func NewPQLBitmapQuery(pql string, index *Index, err error) *PQLBitmapQuery
NewPQLBitmapQuery creates a new PqlBitmapQuery.
func (PQLBitmapQuery) Error ¶
func (q PQLBitmapQuery) Error() error
Error returns the error or nil for this query.
func (*PQLBitmapQuery) Index ¶
func (q *PQLBitmapQuery) Index() *Index
Index returns the index for this query/
type QueryOption ¶ added in v0.8.0
type QueryOption func(options *QueryOptions) error
QueryOption is used when using options with a client.Query,
func ColumnAttrs ¶ added in v0.8.0
func ColumnAttrs(enable bool) QueryOption
ColumnAttrs enables returning column attributes in the result.
func ExcludeAttrs ¶ added in v0.8.0
func ExcludeAttrs(enable bool) QueryOption
ExcludeAttrs enables discarding attributes from a result,
func ExcludeBits ¶ added in v0.8.0
func ExcludeBits(enable bool) QueryOption
ExcludeBits enables discarding bits from a result,
type QueryOptions ¶
type QueryOptions struct {
// Columns enables returning columns in the query response.
Columns bool
// ExcludeAttrs inhibits returning attributes
ExcludeAttrs bool
// ExcludeBits inhibits returning bits
ExcludeBits 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 first column or nil.
func (*QueryResponse) Columns ¶
func (qr *QueryResponse) Columns() []*ColumnItem
Columns returns all columns in the response.
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 struct {
Bitmap *BitmapResult `json:"bitmap,omitempty"`
CountItems []*CountResultItem `json:"count-items,omitempty"`
Count uint64 `json:"count,omitempty"`
Sum int64 `json:"sum,omitempty"`
}
QueryResult represent one of the results in the response.
type RangeField ¶ added in v0.7.0
type RangeField struct {
// contains filtered or unexported fields
}
RangeField enables writing queries for range encoded fields.
func (*RangeField) Between ¶ added in v0.7.0
func (field *RangeField) Between(a int, b int) *PQLBitmapQuery
Between creates a between query.
func (*RangeField) GT ¶ added in v0.7.0
func (field *RangeField) GT(n int) *PQLBitmapQuery
GT creates a greater than query.
func (*RangeField) GTE ¶ added in v0.7.0
func (field *RangeField) GTE(n int) *PQLBitmapQuery
GTE creates a greater than or equal query.
func (*RangeField) LT ¶ added in v0.7.0
func (field *RangeField) LT(n int) *PQLBitmapQuery
LT creates a less than query.
func (*RangeField) LTE ¶ added in v0.7.0
func (field *RangeField) LTE(n int) *PQLBitmapQuery
LTE creates a less than or equal query.
func (*RangeField) SetIntValue ¶ added in v0.7.0
func (field *RangeField) SetIntValue(columnID uint64, value int) *PQLBaseQuery
SetIntValue creates a SetValue query.
func (*RangeField) Sum ¶ added in v0.7.0
func (field *RangeField) Sum(bitmap *PQLBitmapQuery) *PQLBaseQuery
Sum creates a sum query.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema contains the index properties
func (*Schema) Index ¶ added in v0.5.0
func (s *Schema) Index(name string, options ...*IndexOptions) (*Index, error)
Index returns an index with a name and options. Pass nil for default options.
type Status ¶ added in v0.5.0
type Status struct {
Nodes []StatusNode
}
Status contains the status information from a Pilosa server.
type StatusField ¶ added in v0.8.0
StatusField contains a field in the status.
type StatusFrame ¶ added in v0.5.0
type StatusFrame struct {
Name string
Meta StatusMeta
}
StatusFrame contains frame information.
type StatusIndex ¶ added in v0.5.0
type StatusIndex struct {
Name string
Meta StatusMeta
Frames []StatusFrame
Slices []uint64
}
StatusIndex contains index information.
type StatusMeta ¶ added in v0.5.0
type StatusMeta struct {
ColumnLabel string
RowLabel string
CacheType string
CacheSize uint
InverseEnabled bool
RangeEnabled bool
Fields []StatusField
TimeQuantum string
}
StatusMeta contains options for a frame or an index.
type StatusNode ¶ added in v0.5.0
type StatusNode struct {
Scheme string
Host string
Indexes []StatusIndex
}
StatusNode contains node information.
type TimeQuantum ¶
type TimeQuantum string
TimeQuantum type represents valid time quantum values for frames having support for that.
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 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 NewURIFromAddress ¶
NewURIFromAddress parses the passed address and returns a URI.
func NewURIFromHostPort ¶
NewURIFromHostPort returns a URI with specified host and port.
func URIFromAddress ¶ added in v0.8.0
URIFromAddress creates a URI from the given address.
type ValueIterator ¶ added in v0.7.0
type ValueIterator interface {
NextValue() (FieldValue, error)
}
ValueIterator structs return field values one by one.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package gopilosa_pbuf is a generated protocol buffer package.
|
Package gopilosa_pbuf is a generated protocol buffer package. |