Help us shape the future of Go! Take the 2026 Go Developer Survey

pilosa

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: BSD-3-Clause Imports: 19 Imported by: 0

README

Go Client for Pilosa

GoDoc

Go client for Pilosa high performance distributed bitmap index.

Change Log

  • v0.8.0 (2017-11-16)

    • IPv6 support.
    • Deprecation Error* constants. Use Err* constants instead.
    • Deprecation NewClientWithURI, NewClientFromAddresses and NewClientWithCluster functions. Use NewClient function which can be used with the same parameters.
    • Deprecation Passing a *ClientOptions struct to NewClient function. Pass 0 or more ClientOption structs to NewClient instead.
    • Deprecation Passing a *QueryOptions struct to client.Query function. Pass 0 or more QueryOption structs instead.
    • Deprecation Index options.
    • Deprecation Passing a *FrameOptions struct to index.Frame function. Pass 0 or more FrameOption structs instead.
  • v0.7.0 (2017-10-04):

    • Dropped support for Go 1.7.
    • Added support for creating range encoded frames.
    • Added Xor call.
    • Added support for excluding bits or attributes from bitmap calls. In order to exclude bits, pass ExcludeBits: true in your QueryOptions. In order to exclude attributes, pass ExcludeAttrs: true.
    • Added range field operations.
    • Customizable CSV timestamp format.
    • `HTTPS connections are supported.
    • Deprecation Row and column labels are deprecated, and will be removed in a future release of this library. Do not use ColumnLabel option for IndexOptions and RowLabel for FrameOption for new code. See: https://github.com/pilosa/pilosa/issues/752 for more info.
  • v0.5.0 (2017-08-03):

    • Supports imports and exports.
    • Introduced schemas. No need to re-define already existing indexes and frames.
    • NewClientFromAddresses convenience function added. Create a client for a cluster directly from a slice of strings.
    • Failover for connection errors.
    • make commands are supported on Windows.
    • Deprecation NewIndex. Use schema.Index instead.
    • Deprecation CreateIndex, CreateFrame, EnsureIndex, EnsureFrame. Use schemas and client.SyncSchema instead.
  • v0.4.0 (2017-06-09):

    • Supports Pilosa Server v0.4.0.
    • Updated the accepted values for index, frame names and labels to match with the Pilosa server.
    • Union query now accepts zero or more variadic arguments. Intersect and Difference queries now accept one or more variadic arguments.
    • Added inverse TopN and inverse Range calls.
    • Inverse enabled status of frames is not checked on the client side.
  • v0.3.1 (2017-05-01):

    • Initial version.
    • Supports Pilosa Server v0.3.1.

Requirements

  • Go 1.8 and higher

Install

Download the library in your GOPATH using:

go get github.com/pilosa/go-pilosa

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

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

Usage

Quick overview

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

var err error

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

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

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

// Create a Frame object
myframe, err := myindex.Frame("myframe")

// make sure the index and frame exists on the server
err = client.SyncSchema(schema)

// Send a SetBit query. PilosaException is thrown if execution of the query fails.
response, err := client.Query(myframe.SetBit(5, 42))

// Send a Bitmap query. PilosaException is thrown if execution of the query fails.
response, err = client.Query(myframe.Bitmap(5))

// Get the result
result := response.Result()
// Act on the result
if result != nil {
    bits := result.Bitmap.Bits
    fmt.Println("Got bits: %v", bits)
}

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

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

Data Model and Queries
Indexes and Frames

Index and frames are the main data models of Pilosa. You can check the Pilosa documentation for more detail about the data model.

schema.Index function is used to create an index object. Note that this does not create an index on the server; the index object simply defines the schema.

schema := NewSchema()
repository, err := schema.Index("repository")

Frame definitions are created with a call to Frame function of an index:

stargazer, err := repository.Frame("stargazer")

You can pass options to frames:

stargazer, err := repository.Frame("stargazer", pilosa.InverseEnabled(true), pilosa.TimeQuantumYearMonthDay);
Queries

Once you have indexes and frame structs created, you can create queries for them. Some of the queries work on the columns; corresponding methods are attached to the index. Other queries work on rows with related methods attached to frames.

For instance, Bitmap queries work on rows; use a frame object to create those queries:

bitmapQuery := stargazer.Bitmap(1, 100)  // corresponds to PQL: Bitmap(frame='stargazer', row=1)

Union queries work on columns; use the index object to create them:

query := repository.Union(bitmapQuery1, bitmapQuery2)

In order to increase throughput, you may want to batch queries sent to the Pilosa server. The index.BatchQuery function is used for that purpose:

query := repository.BatchQuery(
    stargazer.Bitmap(1, 100),
    repository.Union(stargazer.Bitmap(100, 200), stargazer.Bitmap(5, 100)))

The recommended way of creating query structs is, using dedicated methods attached to index and frame objects. But sometimes it would be desirable to send raw queries to Pilosa. You can use index.RawQuery method for that. Note that query string is not validated before sending to the server:

query := repository.RawQuery("Bitmap(frame='stargazer', row=5)")

This client supports Range encoded fields. Read Range Encoded Bitmaps blog post for more information about the BSI implementation of range encoding in Pilosa.

In order to use range encoded fields, a frame should be created with one or more integer fields. Each field should have their minimums and maximums set. Here's how you would do that using this library:

index, _ := schema.Index("animals")
frame, _ := index.Frame("traits", pilosa.IntField("captivity", 0, 956))
client.SyncSchema(schema)

If the frame with the necessary field already exists on the server, you don't need to create the field instance, client.SyncSchema(schema) would load that to schema. You can then add some data:

// Add the captivity values to the field.
captivity := frame.Field("captivity")
data := []int{3, 392, 47, 956, 219, 14, 47, 504, 21, 0, 123, 318}
query := index.BatchQuery()
for i, x := range data {
	column := uint64(i + 1)
	query.Add(captivity.SetIntValue(column, x))
}
client.Query(query)

Let's write a range query:

// Query for all animals with more than 100 specimens
response, _ := client.Query(captivity.GT(100))
fmt.Println(response.Result().Bitmap.Bits)

// Query for the total number of animals in captivity
response, _ = client.Query(captivity.Sum(nil))
fmt.Println(response.Result().Sum)

It's possible to pass a bitmap query to Sum, so only columns where a row is set are filtered in:

// Let's run a few setbit queries first
client.Query(index.BatchQuery(
    frame.SetBit(42, 1),
    frame.SetBit(42, 6)))
// Query for the total number of animals in captivity where row 42 is set
response, _ = client.Query(captivity.Sum(frame.Bitmap(42)))
fmt.Println(response.Result().Sum)

See the Field functions further below for the list of functions that can be used with a RangeField.

Please check Pilosa documentation for PQL details. Here is a list of methods corresponding to PQL calls:

Index:

  • Union(bitmaps *PQLBitmapQuery...) *PQLBitmapQuery
  • Intersect(bitmaps *PQLBitmapQuery...) *PQLBitmapQuery
  • Difference(bitmaps *PQLBitmapQuery...) *PQLBitmapQuery
  • Xor(bitmaps ...*PQLBitmapQuery) *PQLBitmapQuery
  • Count(bitmap *PQLBitmapQuery) *PQLBaseQuery
  • SetColumnAttrs(columnID uint64, attrs map[string]interface{}) *PQLBaseQuery

Frame:

  • Bitmap(rowID uint64) *PQLBitmapQuery
  • InverseBitmap(columnID uint64) *PQLBitmapQuery
  • SetBit(rowID uint64, columnID uint64) *PQLBaseQuery
  • SetBitTimestamp(rowID uint64, columnID uint64, timestamp time.Time) *PQLBaseQuery
  • ClearBit(rowID uint64, columnID uint64) *PQLBaseQuery
  • TopN(n uint64) *PQLBitmapQuery
  • BitmapTopN(n uint64, bitmap *PQLBitmapQuery) *PQLBitmapQuery
  • FilterFieldTopN(n uint64, bitmap *PQLBitmapQuery, field string, values ...interface{}) *PQLBitmapQuery
  • InverseTopN(n uint64) *PQLBitmapQuery
  • InverseBitmapTopN(n uint64, bitmap *PQLBitmapQuery) *PQLBitmapQuery
  • InverseFilterFieldTopN(n uint64, bitmap *PQLBitmapQuery, field string, values ...interface{}) *PQLBitmapQuery
  • Range(rowID uint64, start time.Time, end time.Time) *PQLBitmapQuery
  • InverseRange(columnID uint64, start time.Time, end time.Time) *PQLBitmapQuery
  • SetRowAttrs(rowID uint64, attrs map[string]interface{}) *PQLBaseQuery
  • (deprecated) Sum(bitmap *PQLBitmapQuery, field string) *PQLBaseQuery
  • (deprecated) SetIntFieldValue(columnID uint64, field string, value int) *PQLBaseQuery

Field:

  • LT(n int) *PQLBitmapQuery
  • LTE(n int) *PQLBitmapQuery
  • GT(n int) *PQLBitmapQuery
  • GTE(n int) *PQLBitmapQuery
  • Between(a int, b int) *PQLBitmapQuery
  • Sum(bitmap *PQLBitmapQuery) *PQLBaseQuery
  • SetIntValue(columnID uint64, value int) *PQLBaseQuery
Pilosa URI

A Pilosa URI has the ${SCHEME}://${HOST}:${PORT} format:

  • Scheme: Protocol of the URI. Default: http.
  • Host: Hostname or ipv4/ipv6 IP address. Default: localhost.
  • Port: Port number. Default: 10101.

All parts of the URI are optional, but at least one of them must be specified. The following are equivalent:

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

A Pilosa URI is represented by the pilosa.URI struct. Below are a few ways to create URI objects:

// create the default URI: http://localhost:10101
uri1 := pilosa.DefaultURI()

// create a URI from string address
uri2, err := pilosa.NewURIFromAddress("index1.pilosa.com:20202");

// create a URI with the given host and port
uri3, err := pilosa.NewURIFromHostPort("index1.pilosa.com", 20202);
Pilosa Client

In order to interact with a Pilosa server, an instance of pilosa.Client should be created. The client is thread-safe and uses a pool of connections to the server, so we recommend creating a single instance of the client and sharing it when necessary.

If the Pilosa server is running at the default address (http://localhost:10101) you can create the client with default options using:

client := pilosa.DefaultClient()

To use a custom server address, use the NewClient function:

uri, err := pilosa.NewURIFromAddress("http://index1.pilosa.com:15000")
if err != nil {
    // Act on the error
}
client, err := pilosa.NewClient(uri)

Equivalently:

client, err := pilosa.NewClient("http://index1.pilosa.com:15000")

If you are running a cluster of Pilosa servers, you can create a Cluster struct that keeps addresses of those servers:

uri1, err := pilosa.NewURIFromAddress(":10101")
uri2, err := pilosa.NewURIFromAddress(":10110")
uri3, err := pilosa.NewURIFromAddress(":10111")
cluster := pilosa.NewClusterWithHost(uri1, uri2, uri3)

// Create a client with the cluster
client, err := pilosa.NewClient(cluster)

That is equivalent to:

client := pilosa.NewClient([]string{":10101", ":10110", ":10111"})

It is possible to customize the behaviour of the underlying HTTP client by passing ClientOption structs to the NewClient function:

client := pilosa.NewClient(cluster,
	pilosa.ConnectTimeout(1000),  // if can't connect in  a second, close the connection 
    pilosa.SocketTimeout(10000),  // if no response received in 10 seconds, close the connection
    pilosa.PoolSizePerRoute(3),  // number of connections in the pool per host
    pilosa.TotalPoolSize(10))   // number of total connections in the pool

Once you create a client, you can create indexes, frames or start sending queries.

Here is how you would create a index and frame:

// materialize repository index definition and stargazer frame definition initialized before
err := client.SyncSchema(schema)

You can send queries to a Pilosa server using the Query function of the Client struct:

response, err := client.Query(frame.Bitmap(5));

Query accepts zero or more options:

response := client.Query(frame.Bitmap(5), pilosa.ColumnAttrs(true), pilosa.ExcludeBits(true))
Server Response

When a query is sent to a Pilosa server, the server either fulfills the query or sends an error message. In the case of an error, a pilosa.Error struct is returned, otherwise a QueryResponse struct is returned.

A QueryResponse struct may contain zero or more results of QueryResult type. You can access all results using the Results function of QueryResponse (which returns a list of QueryResult objects), or you can use the Result method (which returns either the first result or nil if there are no results):

response, err := client.Query(frame.Bitmap(5))
if err != nil {
    // Act on the error
}

// check that there's a result and act on it
result := response.Result()
if result != nil {
    // Act on the result
}

// iterate over all results
for result := range response.Results() {
    // Act on the result
}

Similarly, a QueryResponse struct may include a number of columns (column objects) if Columns query option was set to true:

var column *pilosa.ColumnItem

// check that there's a column and act on it
column = response.Column()
if (column != null) {
    // Act on the column
}

// iterate over all columns
for column = range response.Columns() {
    // Act on the column
}

QueryResult objects contain:

  • Bitmap field to retrieve a bitmap result,
  • CountItems fied to retrieve column count per row ID entries returned from TopN queries,
  • Count field to retrieve the number of rows per the given row ID returned from Count queries.
bitmap := result.Bitmap
bits := bitmap.Bits
attributes := bitmap.Attributes

countItems := result.CountItems

count := result.Count

Importing and Exporting Data

Importing Data

If you have large amounts of data, it is more efficient to import it into Pilosa instead of using multiple SetBit queries. This library supports importing bits into an existing frame.

Before starting the import, create an instance of a struct which implements BitIterator and pass it to the client.ImportFrame function. This library ships with the CSVBitIterator struct which supports importing bits in the CSV (comma separated values) format:

ROW_ID,COLUMN_ID

Optionally, a timestamp can be added. Note that Pilosa is not time zone aware:

ROW_ID,COLUMN_ID,TIMESTAMP

Note that each line corresponds to a single bit and ends with a new line (\n or \r\n).

Here's some sample code:

text := `10,7
    10,5
    2,3
    7,1`
iterator := NewCSVBitIterator(strings.NewReader(text))

After creating the iterator you can pass it to client.ImportFrame together with the frame and batch size. The following sample sends batches with size 10000 bits:

err = client.ImportFrame(frame, iterator, 10000)
if err != nil {
    panic(err)
}

You can define a custom BitIterator by including a function with the signature NextBit() (Bit, error) in your struct.

type StaticBitIterator struct {
    NextBit() (Bit, error)
    bits []Bit
    index int
}

func NewStaticBitIterator() *StaticBitIterator {
    return &StaticBitIterator{
        bits: []Bit{
            Bit{RowID: 1, ColumnID: 1, Timestamp: 683793200},
            Bit{RowID: 5, ColumnID: 20, Timestamp: 683793300},
            Bit{RowID: 3, ColumnID: 41, Timestamp: 683793385},
        }
    }
}

func (it *StatiBitIterator) NextBit(Bit, error) {
    if it.index < len(it.bits) {
        return Bit{}, io.EOF
    }
    return it.bits[it.index++], nil
}
Exporting Data

You can export a view of a frame from Pilosa using client.ExportFrame function which returns a BitIterator. Use the NextBit function of this iterator to receive all bits for the specified frame. When there are no more bits, io.EOF is returned.

The PilosaClient struct has the Views function which returns all of the views for a particular frame. You can use this function to retrieve view names:

views, err := client.Views(frame)

Here's sample code which retrieves bits of the standard view:

bits := []Bit{}
iterator, err := client.ExportFrame(frame, "standard")
if err != nil {
    t.Fatal(err)
}
for {
    bit, err := iterator.NextBit()
    if err == io.EOF {
        break
    }
    if err != nil {
        t.Fatal(err)
    }
    bits = append(bits, bit)
}

Contribution

Please check our Contributor's Guidelines.

  1. Fork this repo and add it as upstream: git remote add upstream git@github.com:pilosa/go-pilosa.git.
  2. Make sure all tests pass (use make test-all) and be sure that the tests cover all statements in your code (we aim for 100% test coverage).
  3. Commit your code to a feature branch and send a pull request to the master branch of our repo.
Running tests

You can run unit tests with:

make test

And both unit and integration tests with:

make test-all

Check the test coverage:

make cover
Generating protobuf classes

Protobuf classes are already checked in to source control, so this step is only needed when the upstream public.proto changes.

Before running the following step, make sure you have the Protobuf compiler and Go protobuf support is installed:

make generate

License

Copyright 2017 Pilosa Corp.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

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

Constants

This section is empty.

Variables

View Source
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.

View Source
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

func ValidFrameName(name string) bool

ValidFrameName returns true if the given frame name is valid, otherwise false.

func ValidIndexName

func ValidIndexName(name string) bool

ValidIndexName returns true if the given index name is valid, otherwise false.

func ValidLabel

func ValidLabel(label string) bool

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

Types

type Bit added in v0.5.0

type Bit struct {
	RowID     uint64
	ColumnID  uint64
	Timestamp int64
}

Bit defines a single Pilosa bit.

type BitIterator added in v0.5.0

type BitIterator interface {
	NextBit() (Bit, error)
}

BitIterator structs return bits one by one.

type BitmapResult

type BitmapResult struct {
	Attributes map[string]interface{}
	Bits       []uint64
}

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 CacheType

type CacheType string

CacheType represents cache type for a frame

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

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 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

func NewClientWithURI(uri *URI) *Client

NewClientWithURI creates a client with the given server address.

func (*Client) CreateFrame

func (c *Client) CreateFrame(frame *Frame) error

CreateFrame creates a frame on the server using the given Frame 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) CreateIntField added in v0.7.0

func (c *Client) CreateIntField(frame *Frame, name string, min int, max int) error

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

func (c *Client) DeleteField(frame *Frame, name string) error

DeleteField delete a range field. *Experimental*: This feature may be removed or its interface may be modified in the future.

func (*Client) DeleteFrame

func (c *Client) DeleteFrame(frame *Frame) error

DeleteFrame deletes a frame on the server.

func (*Client) DeleteIndex

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

DeleteIndex deletes an index on the server.

func (*Client) EnsureFrame

func (c *Client) EnsureFrame(frame *Frame) error

EnsureFrame creates a frame 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) 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) Schema

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

Schema returns the indexes and frames on the server.

func (*Client) SyncSchema added in v0.5.0

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

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.

func (*Client) Views added in v0.5.0

func (c *Client) Views(frame *Frame) ([]string, error)

Views fetches and returns the views of a frame

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 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 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

type CountResultItem struct {
	ID    uint64
	Count uint64
}

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 FieldValue added in v0.7.0

type FieldValue struct {
	ColumnID uint64
	Value    int64
}

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

func (f *Frame) InverseRange(columnID uint64, start time.Time, end time.Time) *PQLBitmapQuery

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) Name added in v0.5.0

func (f *Frame) Name() string

Name returns the name of the frame

func (*Frame) Range

func (f *Frame) Range(rowID uint64, start time.Time, end time.Time) *PQLBitmapQuery

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

func (f *Frame) SetBitTimestamp(rowID uint64, columnID uint64, timestamp time.Time) *PQLBaseQuery

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) String added in v0.8.0

func (f *Frame) String() string

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) Frame

func (idx *Index) Frame(name string, options ...interface{}) (*Frame, error)

Frame creates a frame struct with the specified name and defaults.

func (*Index) Frames added in v0.5.0

func (idx *Index) Frames() map[string]*Frame

Frames return a copy of the frames in this index

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) Name

func (idx *Index) Name() string

Name returns the name 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(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) String added in v0.8.0

func (idx *Index) String() string

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 PQLQuery

type PQLQuery interface {
	Index() *Index

	Error() error
	// contains filtered or unexported methods
}

PQLQuery is an interface for PQL queries.

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 NewSchema added in v0.5.0

func NewSchema() *Schema

NewSchema creates a new Schema

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.

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 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

type StatusField struct {
	Name string
	Type string
	Max  int64
	Min  int64
}

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 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 ValueIterator added in v0.7.0

type ValueIterator interface {
	NextValue() (FieldValue, error)
}

ValueIterator structs return field values one by one.

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