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" // AggregationMin represents the minimum aggregation key. AggregationMin = "min" // AggregationMax represents the maximum aggregation key. AggregationMax = "max" // AggregationAvg represents the average aggregation key. AggregationAvg = "avg" // AggregationCount represents the count aggregation key. AggregationCount = "count" )
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 Backup ¶ added in v0.35.0
type Backup struct {
JSONMessages JSONMessagesPage
SenMLMessages SenMLMessagesPage
}
type JSONMessageRepository ¶ added in v0.30.1
type JSONMessageRepository interface {
// Retrieve retrieves the json messages with given filters.
Retrieve(ctx context.Context, rpm JSONPageMetadata) (JSONMessagesPage, error)
// Backup backups the json messages with given filters.
Backup(ctx context.Context, rpm JSONPageMetadata) (JSONMessagesPage, error)
// Restore restores the json messages.
Restore(ctx context.Context, messages ...Message) error
// Remove deletes the json messages within a time range.
Remove(ctx context.Context, rpm JSONPageMetadata) error
}
type JSONMessagesPage ¶ added in v0.30.0
type JSONMessagesPage struct {
JSONPageMetadata
MessagesPage
}
type JSONPageMetadata ¶ added in v0.30.0
type JSONPageMetadata struct {
Offset uint64 `json:"offset"`
Limit uint64 `json:"limit"`
Subtopic string `json:"subtopic,omitempty"`
Publisher string `json:"publisher,omitempty"`
Protocol string `json:"protocol,omitempty"`
From int64 `json:"from,omitempty"`
To int64 `json:"to,omitempty"`
Filter string `json:"filter,omitempty"`
AggInterval string `json:"agg_interval,omitempty"`
AggValue uint64 `json:"agg_value,omitempty"`
AggType string `json:"agg_type,omitempty"`
AggFields []string `json:"agg_fields,omitempty"`
Dir string `json:"dir,omitempty"`
}
JSONPageMetadata represents the parameters used to create database queries
type MessagesPage ¶
type SenMLMessageRepository ¶ added in v0.30.1
type SenMLMessageRepository interface {
// Retrieve retrieves the senml messages with given filters.
Retrieve(ctx context.Context, rpm SenMLPageMetadata) (SenMLMessagesPage, error)
// Backup backups the senml messages with given filters.
Backup(ctx context.Context, rpm SenMLPageMetadata) (SenMLMessagesPage, error)
// Restore restores the senml messages.
Restore(ctx context.Context, messages ...Message) error
// Remove deletes the senml messages within a time range.
Remove(ctx context.Context, rpm SenMLPageMetadata) error
}
type SenMLMessagesPage ¶ added in v0.30.0
type SenMLMessagesPage struct {
SenMLPageMetadata
MessagesPage
}
type SenMLPageMetadata ¶ added in v0.30.0
type SenMLPageMetadata 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 int64 `json:"from,omitempty"`
To int64 `json:"to,omitempty"`
AggInterval string `json:"agg_interval,omitempty"`
AggValue uint64 `json:"agg_value,omitempty"`
AggType string `json:"agg_type,omitempty"`
AggFields []string `json:"agg_fields,omitempty"`
Dir string `json:"dir,omitempty"`
}
SenMLPageMetadata represents the parameters used to create database queries
type Service ¶ added in v0.30.1
type Service interface {
// ListJSONMessages retrieves the json messages with given filters.
ListJSONMessages(ctx context.Context, token string, key things.ThingKey, rpm JSONPageMetadata) (JSONMessagesPage, error)
// ListSenMLMessages retrieves the senml messages with given filters.
ListSenMLMessages(ctx context.Context, token string, key things.ThingKey, rpm SenMLPageMetadata) (SenMLMessagesPage, error)
// ExportJSONMessages retrieves the json messages with given filters, intended for exporting.
ExportJSONMessages(ctx context.Context, token string, rpm JSONPageMetadata) (JSONMessagesPage, error)
// ExportSenMLMessages retrieves the senml messages with given filters, intended for exporting.
ExportSenMLMessages(ctx context.Context, token string, rpm SenMLPageMetadata) (SenMLMessagesPage, error)
// Backup backups all json and senml messages.
Backup(ctx context.Context, token string) (Backup, error)
// Restore restores json and senml messages.
Restore(ctx context.Context, token string, backup Backup) error
// DeleteJSONMessages deletes the json messages by publisher within a time range.
DeleteJSONMessages(ctx context.Context, token string, rpm JSONPageMetadata) error
// DeleteSenMLMessages deletes the senml messages by publisher within a time range.
DeleteSenMLMessages(ctx context.Context, token string, rpm SenMLPageMetadata) error
// DeleteAllJSONMessages deletes the senml messages within a time range, requires admin privileges.
DeleteAllJSONMessages(ctx context.Context, token string, rpm JSONPageMetadata) error
// DeleteAllSenMLMessages deletes the senml messages within a time range, requires admin privileges.
DeleteAllSenMLMessages(ctx context.Context, token string, rpm SenMLPageMetadata) error
}
Service specifies an API that must be fullfiled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func New ¶ added in v0.30.1
func New(auth protomfx.AuthServiceClient, things protomfx.ThingsServiceClient, json JSONMessageRepository, senml SenMLMessageRepository) Service
Directories
¶
| Path | Synopsis |
|---|---|
|
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. |
|
Package tracing contains middlewares that will add spans to existing traces.
|
Package tracing contains middlewares that will add spans to existing traces. |
Click to show internal directories.
Click to hide internal directories.