readers

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

Readers

Readers provide an implementation of various message readers. Message readers are services that consume normalized (in SenML format) Mainflux messages from data storage and opens HTTP API for message consumption.

For an in-depth explanation of the usage of reader, as well as thorough understanding of Mainflux, please check out the official documentation.

Documentation

Index

Constants

View Source
const (
	// EqualKey represents the equal comparison operator key.
	EqualKey = "eq"
	// LowerThanKey represents the lower-than comparison operator key.
	LowerThanKey = "lt"
	// LowerThanEqualKey represents the lower-than-or-equal comparison operator key.
	LowerThanEqualKey = "le"
	// GreaterThanKey represents the greater-than-or-equal comparison operator key.
	GreaterThanKey = "gt"
	// GreaterThanEqualKey represents the greater-than-or-equal comparison operator key.
	GreaterThanEqualKey = "ge"
)

Variables

View Source
var ErrReadMessages = errors.New("failed to read messages from database")

ErrReadMessages indicates failure occurred while reading messages from database.

Functions

func ParseValueComparator

func ParseValueComparator(query map[string]interface{}) string

ParseValueComparator convert comparison operator keys into mathematic anotation

Types

type Message

type Message interface{}

Message represents any message format.

type MessageRepository

type MessageRepository interface {
	// ListAllMessages retrieves all messages from database.
	ListAllMessages(rpm PageMetadata) (MessagesPage, error)

	// Restore restores message database from a backup.
	Restore(ctx context.Context, messages ...senml.Message) error

	// Backup retrieves all messages from database.
	Backup(rpm PageMetadata) (MessagesPage, error)
}

MessageRepository specifies message reader API.

type MessagesPage

type MessagesPage struct {
	PageMetadata
	Total    uint64
	Messages []Message
}

MessagesPage contains page related metadata as well as list of messages that belong to this page.

type PageMetadata

type PageMetadata struct {
	Offset      uint64  `json:"offset"`
	Limit       uint64  `json:"limit"`
	Subtopic    string  `json:"subtopic,omitempty"`
	Publisher   string  `json:"publisher,omitempty"`
	Protocol    string  `json:"protocol,omitempty"`
	Name        string  `json:"name,omitempty"`
	Value       float64 `json:"v,omitempty"`
	Comparator  string  `json:"comparator,omitempty"`
	BoolValue   bool    `json:"vb,omitempty"`
	StringValue string  `json:"vs,omitempty"`
	DataValue   string  `json:"vd,omitempty"`
	From        float64 `json:"from,omitempty"`
	To          float64 `json:"to,omitempty"`
	Format      string  `json:"format,omitempty"`
}

PageMetadata represents the parameters used to create database queries

Directories

Path Synopsis
Package influxdb contains the domain concept definitions needed to support Mainflux InfluxDB reader service functionality.
Package influxdb contains the domain concept definitions needed to support Mainflux InfluxDB reader service functionality.
Package mongodb contains the domain concept definitions needed to support Mainflux MondoDB reader service functionality.
Package mongodb contains the domain concept definitions needed to support Mainflux MondoDB reader service functionality.
Package postgres contains repository implementations using Postgres as the underlying database.
Package postgres contains repository implementations using Postgres as the underlying database.
Package timescale contains repository implementations using Timescale as the underlying database.
Package timescale contains repository implementations using Timescale as the underlying database.

Jump to

Keyboard shortcuts

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