influxqu

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 8 Imported by: 0

README

go-influx-qu

A simple library converts structures to InfluxDB point and covert back from InfluxDB records to structures

How to use it

  1. Tag your structure fields,
  2. Call GenerateInfluxPoint to conver your structure to InfluxDB points

Note

if there i NO timestamp tag proived, will use current time as the point's timestamp

type Data struct {
        Base      string    `influxqu:"measurement"`
	T1        string    `influxqu:"tag,t1"`
	T2        string    `influxqu:"tag,t2"`
	F1        int       `influxqu:"field,f1"`
	F2        bool      `influxqu:"field,f2"`
	Timestamp time.Time `influxqu:"timestamp"`

}

func main() {
    data := Data{
		Base:      "base",
		T1:        "t1",
		T2:        "t2",
		F1:        1,
		F2:        true,
		Timestamp: time.Now(),
	}

    g := NewinfluxQu()
    p, e := g.GenerateInfluxPoint(&data)

    // balbal
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicatedField

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

func (*DuplicatedField) Error

func (e *DuplicatedField) Error() string

type DuplicatedKey

type DuplicatedKey struct{}

func (*DuplicatedKey) Error

func (e *DuplicatedKey) Error() string

type DuplicatedMeasurement

type DuplicatedMeasurement struct{}

func (*DuplicatedMeasurement) Error

func (e *DuplicatedMeasurement) Error() string

type DuplicatedTag

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

func (*DuplicatedTag) Error

func (e *DuplicatedTag) Error() string

type DuplicatedTimestamp

type DuplicatedTimestamp struct{}

func (*DuplicatedTimestamp) Error

func (e *DuplicatedTimestamp) Error() string

type InfluxQu

type InfluxQu interface {
	GenerateInfluxPoint(val interface{}) (*write.Point, error)
	GenerateFluxQuery(bucket, start, end string, val interface{}, suffix []string) (query string, cols []string, err error)
}

func NewinfluxQu

func NewinfluxQu() InfluxQu

func NewinfluxQuWithKeys

func NewinfluxQuWithKeys(key string, measurementKey string, tagKey string, fieldKey string, timestampKey string) (InfluxQu, error)

type NoFieldName

type NoFieldName struct{}

func (*NoFieldName) Error

func (e *NoFieldName) Error() string

type NoTagName

type NoTagName struct{}

func (*NoTagName) Error

func (e *NoTagName) Error() string

type NoValidField added in v0.0.8

type NoValidField struct{}

func (*NoValidField) Error added in v0.0.8

func (e *NoValidField) Error() string

type NoValidMeasurement added in v0.0.8

type NoValidMeasurement struct{}

func (*NoValidMeasurement) Error added in v0.0.8

func (e *NoValidMeasurement) Error() string

type UnSupportedTag added in v0.0.4

type UnSupportedTag struct{}

func (*UnSupportedTag) Error added in v0.0.4

func (e *UnSupportedTag) Error() string

type UnSupportedType

type UnSupportedType struct{}

func (*UnSupportedType) Error

func (e *UnSupportedType) Error() string

Jump to

Keyboard shortcuts

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