more documenting. starting to update readme.
parent
2b4f155407
commit
97dc11c96d
|
@ -1,4 +1,7 @@
|
||||||
InfluxDB Go Client Library
|
InfluxDB Go Client Library
|
||||||
============
|
============
|
||||||
|
|
||||||
# TODO Add links to the godoc and examples when they are written
|
#
|
||||||
|
# Examples
|
||||||
|
|
||||||
|
You can see a use of the client libray in the [InfluxDB CLI](https://github.com/influxdb/influxdb/blob/master/cmd/influx/main.go).
|
||||||
|
|
|
@ -130,6 +130,8 @@ func (c *Client) Write(bp BatchPoints) (*Results, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ping will check to see if the server is up
|
||||||
|
// Ping returns how long the requeset took, the version of the server it connected to, and an error if one occured.
|
||||||
func (c *Client) Ping() (time.Duration, string, error) {
|
func (c *Client) Ping() (time.Duration, string, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
u := c.url
|
u := c.url
|
||||||
|
@ -250,6 +252,9 @@ func (a Results) Error() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Point defines the fields that will be written to the database
|
// Point defines the fields that will be written to the database
|
||||||
|
// Name, Timestamp, and Fields are required
|
||||||
|
// Precision can be specified if the timestamp is in epoch format (integer).
|
||||||
|
// Valid values for Precision are n, u, ms, s, m, and h
|
||||||
type Point struct {
|
type Point struct {
|
||||||
Name string
|
Name string
|
||||||
Tags map[string]string
|
Tags map[string]string
|
||||||
|
@ -357,6 +362,12 @@ func normalizeFields(fields map[string]interface{}) map[string]interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
// BatchPoints is used to send batched data in a single write.
|
// BatchPoints is used to send batched data in a single write.
|
||||||
|
// Database and Points are required
|
||||||
|
// If no retention policy is specified, it will use the databases default retention policy.
|
||||||
|
// If tags are specified, they will be "merged" with all points. If a point already has that tag, it is ignored.
|
||||||
|
// If timestamp is specified, it will be applied to any point with an empty timestamp.
|
||||||
|
// Precision can be specified if the timestamp is in epoch format (integer).
|
||||||
|
// Valid values for Precision are n, u, ms, s, m, and h
|
||||||
type BatchPoints struct {
|
type BatchPoints struct {
|
||||||
Points []Point `json:"points,omitempty"`
|
Points []Point `json:"points,omitempty"`
|
||||||
Database string `json:"database,omitempty"`
|
Database string `json:"database,omitempty"`
|
||||||
|
@ -425,6 +436,7 @@ func (bp *BatchPoints) UnmarshalJSON(b []byte) error {
|
||||||
|
|
||||||
// utility functions
|
// utility functions
|
||||||
|
|
||||||
|
// Addr provides the current url as a string of the server the client is connected to.
|
||||||
func (c *Client) Addr() string {
|
func (c *Client) Addr() string {
|
||||||
return c.url.String()
|
return c.url.String()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue