Documentation
¶
Overview ¶
InfluxDB client (c) Copyright David Thorpe 2017 All Rights Reserved
For Licensing and Usage information, please see LICENSE file ¶
InfluxDB client (c) Copyright David Thorpe 2017 All Rights Reserved
For Licensing and Usage information, please see LICENSE file
Index ¶
- Constants
- Variables
- func Quote(value string) string
- func QuoteString(value string) string
- type Client
- type Dataset
- type Measurement
- type Predicate
- type Query
- func AlterRetentionPolicy(database string, name string, policy *RetentionPolicy) Query
- func CreateDatabase(name string) Query
- func CreateRetentionPolicy(database string, name string, policy *RetentionPolicy) Query
- func DropDatabase(name string) Query
- func DropRetentionPolicy(database string, name string) Query
- func Select(measurements ...*Measurement) Query
- func ShowDatabases() Query
- func ShowMeasurements() Query
- func ShowRetentionPolicies() Query
- func ShowSeries() Query
- type Result
- type Results
- type RetentionPolicy
- type Value
Constants ¶
const ( // Precision defines the precision used for time values on inserting // data and returning it PRECISION_NANO string = "ns" PRECISION_MICRO string = "µ" PRECISION_MICRO2 string = "u" PRECISION_MILLI string = "ms" PRECISION_SECOND string = "s" PRECISION_MINUTE string = "m" PRECISION_HOUR string = "h" PRECISION_DAY string = "d" PRECISION_WEEK string = "w" PRECISION_DEFAULT string = PRECISION_MILLI )
const ( // DefaultPortHTTP defines the default InfluxDB port used for HTTP DefaultPortHTTP uint = 8086 )
Variables ¶
var ( // ErrNotConnected is returned when database is not connected (Close has been called) ErrNotConnected = errors.New("Not connected") // ErrNotFound is returned when something expected is not found ErrNotFound = errors.New("Not Found") // ErrAlreadyExists is returned when something already exists ErrAlreadyExists = errors.New("Already Exists") // ErrUnexpectedResponse is returned when server does not return with expected data ErrUnexpectedResponse = errors.New("Unexpected response from server") // ErrEmptyResponse is returned when response does not contain any data ErrEmptyResponse = errors.New("Empty response from server") // ErrBadParameter is returned when some calling parameter is invalid ErrBadParameter = errors.New("Bad Parameter") // ErrNotSupported is returned if a feature is not yet supported ErrNotSupported = errors.New("Not supported") )
Functions ¶
func Quote ¶
Quote returns a query-safe version of an identifier (a database, series or measurement name)
func QuoteString ¶
Returns a version of the string which has double-quotes around it, and will replace baskslashes with double backslashes and double quotes with backslash + double quote
Types ¶
type Client ¶
type Client interface {
gopi.Driver
// Get and set parameters
Version() string
Database() string
SetDatabase(value string) error
Precision() string
SetPrecision(value string) error
// Convenience methods for database and retention policy
CreateDatabase(name string, policy *RetentionPolicy) error
CreateRetentionPolicy(name string, policy *RetentionPolicy) error
DropDatabase(name string) error
DropRetentionPolicy(name string) error
RetentionPolicies() (map[string]*RetentionPolicy, error)
// Excute a query
Do(query Query) (Results, error)
// Return an empty dataset and write data
NewDataset(name string, tags, fields []string) (Dataset, error)
Write(Dataset) error
}
Client is the abstract driver interface
type Dataset ¶
type Dataset interface {
// Dataset read operations
Tags() []string
Tag(key string) string
Fields() []string
Len() uint
Name() string
Partial() bool
ValuesAtIndex(uint) (time.Time, []Value)
// Dataset write operations
SetTag(key, value string)
AddValues(values ...Value) error
AddValuesForTimestamp(ts time.Time, values ...Value) error
}
Dataset is an abstract set of data which is written or read from the database
type Measurement ¶
Measurement defines a measurement
func (Measurement) String ¶
func (m Measurement) String() string
type Predicate ¶
type Predicate interface {
// Return the predicate as a string
String() string
}
Predicate is an abstract predicate (a tag, a field or a function)
func TagMatches ¶
func TagNotEquals ¶
type Query ¶
type Query interface {
// Set parameters
Database(value string) Query
RetentionPolicy(value *RetentionPolicy) Query
Default(value bool) Query
Measurement(values ...*Measurement) Query
OffsetLimit(offset uint, limit uint) Query
Filter(values ...Predicate) Query
// Return the query as a string
String() string
}
Query is the abstract InfluxQL statement interface
func AlterRetentionPolicy ¶
func AlterRetentionPolicy(database string, name string, policy *RetentionPolicy) Query
func CreateDatabase ¶
func CreateRetentionPolicy ¶
func CreateRetentionPolicy(database string, name string, policy *RetentionPolicy) Query
func DropDatabase ¶
func DropRetentionPolicy ¶
func Select ¶
func Select(measurements ...*Measurement) Query
func ShowDatabases ¶
func ShowDatabases() Query
func ShowMeasurements ¶
func ShowMeasurements() Query
func ShowRetentionPolicies ¶
func ShowRetentionPolicies() Query
func ShowSeries ¶
func ShowSeries() Query
type Result ¶
type Result struct {
Result int
Series int
Name string
Tags map[string]string
Columns []string
Values [][]interface{}
Partial bool
}
Result reflects the influxdb model.Row structure but which defines a number of additional methods
func (*Result) ParseRetentionPolicies ¶
func (r *Result) ParseRetentionPolicies() (map[string]*RetentionPolicy, error)
ParseRetentionPolicies returns retention policies from a server response
type Results ¶
type Results []*Result
Results is a set of results (usually one, but may be more if more than one measure is selected)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
InfluxDB command-line tool
|
InfluxDB command-line tool |
|
InfluxDB client (c) Copyright David Thorpe 2017 All Rights Reserved For Licensing and Usage information, please see LICENSE file
|
InfluxDB client (c) Copyright David Thorpe 2017 All Rights Reserved For Licensing and Usage information, please see LICENSE file |