client

package
v0.9.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2015 License: MIT Imports: 8 Imported by: 0

README

InfluxDB Go Client Library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpochToTime

func EpochToTime(epoch int64, precision string) (time.Time, error)

EpochToTime takes a unix epoch time and uses precision to return back a time.Time

func SetPrecision

func SetPrecision(t time.Time, precision string) time.Time

SetPrecision will round a time to the specified precision

Types

type Client

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

func NewClient

func NewClient(c Config) (*Client, error)

func (*Client) Addr

func (c *Client) Addr() string

func (*Client) Ping

func (c *Client) Ping() (time.Duration, string, error)

func (*Client) Query

func (c *Client) Query(q Query) (*Results, error)

func (*Client) Write

func (c *Client) Write(writes ...Write) (*Results, error)

type Config

type Config struct {
	URL      url.URL
	Username string
	Password string
}

type Point

type Point struct {
	Name      string                 `json:"name"`
	Tags      map[string]string      `json:"tags"`
	Timestamp Timestamp              `json:"timestamp"`
	Values    map[string]interface{} `json:"values"`
	Precision string                 `json:"precision"`
}

Point defines the values that will be written to the database

func (*Point) UnmarshalJSON

func (p *Point) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the data into the Point struct

type Query

type Query struct {
	Command  string
	Database string
}

type Result

type Result struct {
	Rows []influxql.Row
	Err  error
}

Result represents a resultset returned from a single statement.

func (*Result) MarshalJSON

func (r *Result) MarshalJSON() ([]byte, error)

MarshalJSON encodes the result into JSON.

func (*Result) UnmarshalJSON

func (r *Result) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the data into the Result struct

type Results

type Results struct {
	Results []Result
	Err     error
}

Results represents a list of statement results.

func (Results) Error

func (a Results) Error() error

Error returns the first error from any statement. Returns nil if no errors occurred on any statements.

func (Results) MarshalJSON

func (r Results) MarshalJSON() ([]byte, error)

func (*Results) UnmarshalJSON

func (r *Results) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the data into the Results struct

type Timestamp

type Timestamp time.Time

Timestamp is a custom type so we marshal JSON properly into UTC nanosecond time

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON returns time in UTC with nanoseconds

func (Timestamp) Time

func (t Timestamp) Time() time.Time

Time returns the time represented by the Timestamp

type Write

type Write struct {
	Database        string
	RetentionPolicy string
	Points          []Point
}

Jump to

Keyboard shortcuts

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