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 ¶
ParseValueComparator convert comparison operator keys into mathematic anotation.
Types ¶
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 mocks contains mocks for testing purposes.
|
Package mocks contains mocks for testing purposes. |
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. |
Click to show internal directories.
Click to hide internal directories.