readers

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

Readers

Readers provide implementations of various message readers. Message readers are services that consume normalized (in SenML format) Magistrala messages from data storage and expose HTTP API for message consumption.

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

Documentation

Overview

Package readers provides a set of readers for various formats.

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 {
	// ReadAll skips given number of messages for given channel and returns next
	// limited number of messages.
	ReadAll(chanID string, pm 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"`
	Aggregation string  `json:"aggregation,omitempty"`
	Interval    string  `json:"interval,omitempty"`
}

PageMetadata represents the parameters used to create database queries.

Directories

Path Synopsis
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
Package cassandra contains Cassandra specific reader implementation.
Package cassandra contains Cassandra specific reader implementation.
Package influxdb contains the domain concept definitions needed to support Magistrala InfluxDB reader service functionality.
Package influxdb contains the domain concept definitions needed to support Magistrala InfluxDB reader service functionality.
Package mocks contains mocks for testing purposes.
Package mocks contains mocks for testing purposes.
Package mongodb contains the domain concept definitions needed to support Magistrala MondoDB reader service functionality.
Package mongodb contains the domain concept definitions needed to support Magistrala 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