influxgo

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

influxgo

A simple library to write and query influxdb,

This Library only support some simple features :

  1. write data into database
  2. query the last n time data, like last 3 days or last 5 minutes

It need influxdb1.8.x or before

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IfxCli

type IfxCli struct {
	Ip       string
	Port     int
	User     string
	PassWord string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ip string, port int, user, passWord string) *IfxCli

create a new influxdb client; if the user and password was not be set in your influxdb server, set it as ""

func (*IfxCli) GetDatabases

func (f *IfxCli) GetDatabases() ([]string, error)

get all the name of databases

func (*IfxCli) Ping added in v0.0.3

func (f *IfxCli) Ping() error

func (*IfxCli) QueryBetweenWithTag added in v0.0.5

func (f *IfxCli) QueryBetweenWithTag(
	db, measure, tagName, tagValue string, start, end int, timeType string) (QueryResp, error)

func (*IfxCli) QueryLastNTime

func (f *IfxCli) QueryLastNTime(db, measure string, n int, tp string) (QueryResp, error)

query the latest time data; n: the number of time duration; timeType support: "s": second, "m": minute, "h": hour, "d": day, "w": week

func (*IfxCli) QueryLastNTimeByTag

func (f *IfxCli) QueryLastNTimeByTag(db, measure, tagName, tagValue string, n int, timeType string) (QueryResp, error)

query the latest time data by set the tag, n: the number of time duration timeType support: "s": second, "m": minute, "h": hour, "d": day, "w": week

func (*IfxCli) QueryMeasure

func (f *IfxCli) QueryMeasure(start, end time.Time)

func (*IfxCli) Write

func (f *IfxCli) Write(data WriteData) error

type IfxResp

type IfxResp struct {
	Name    string     `json:"name"`
	Columns []string   `json:"columns"`
	Values  [][]string `json:"values"`
}

github.com/cngobd/influxgo

type QueryResp

type QueryResp struct {
	Columns []string
	Values  [][]interface{}
}

type WriteData

type WriteData struct {
	DB          string
	Measurement string
	Tags        map[string]interface{}
	Fields      map[string]interface{}
}

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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