client

package
v0.9.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 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 added in v0.9.0

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

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

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

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

type Config added in v0.9.0

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

type Point added in v0.9.0

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

Point defines the fields that will be written to the database

func (*Point) UnmarshalJSON added in v0.9.0

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

UnmarshalJSON decodes the data into the Point struct

type Query added in v0.9.0

type Query struct {
	Command  string
	Database string
}

type Result added in v0.9.0

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

Result represents a resultset returned from a single statement.

func (*Result) MarshalJSON added in v0.9.0

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

MarshalJSON encodes the result into JSON.

func (*Result) UnmarshalJSON added in v0.9.0

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