Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunWriteConsumerSync ¶
func RunWriteConsumerSync[T Influxable]( db *InfluxDBAdapter, measurement string, incomingData <-chan T, )
RunWriteConsumerSync reads from incomingData channel and stores the data to via a provided InfluxDBAdapter ('db' arg.). In case 'db' is nil, the function just listens to 'incomingData' and does nothing. Typically, this function should run in its own goroutine.
Types ¶
type ConnectionConf ¶
type ConnectionConf struct { Server string `json:"server"` Token string `json:"token"` Organization string `json:"organization"` Bucket string `json:"bucket"` }
ConnectionConf specifies a configuration required to store data to an InfluxDB database
func (*ConnectionConf) IsConfigured ¶
func (conf *ConnectionConf) IsConfigured() bool
IsConfigured tests whether the configuration is considered to be enabled (i.e. no error checking just enabled/disabled)
type InfluxDBAdapter ¶ added in v0.2.0
type InfluxDBAdapter struct {
// contains filtered or unexported fields
}
func ConnectAPI ¶
func ConnectAPI(conf *ConnectionConf, errListen <-chan error) *InfluxDBAdapter
func (*InfluxDBAdapter) Address ¶ added in v0.2.0
func (db *InfluxDBAdapter) Address() string
func (*InfluxDBAdapter) WritePoint ¶ added in v0.2.0
func (db *InfluxDBAdapter) WritePoint(p *write.Point)
type Influxable ¶
type Influxable interface { // ToInfluxDB defines a method providing data // to be written to a database. The first returned // value is for tags, the second one for fields. ToInfluxDB() (map[string]string, map[string]any) // GetTime provides a date and time when the record // was created. GetTime() time.Time }
Influxable represents any type which is able to export its data in a format required by InfluxDB.
type RecordWriter ¶
type RecordWriter[T Influxable] struct { // contains filtered or unexported fields }
RecordWriter is a simple wrapper around InfluxDB client allowing adding records in a convenient way.
func NewRecordWriter ¶
func NewRecordWriter[T Influxable](db *InfluxDBAdapter) *RecordWriter[T]
NewRecordWriter is a factory function for RecordWriter
func (*RecordWriter[T]) AddRecord ¶
func (c *RecordWriter[T]) AddRecord(measurement string, rec T)
AddRecord adds a record to a respective InfluxDB database and measurement.