Documentation
¶
Index ¶
- Constants
- Variables
- func ComparatorSymbol(key string) string
- func ParseValueComparator(query map[string]any) string
- type Backup
- type JSONMessageRepository
- type JSONMessagesPage
- type JSONPageMetadata
- type Message
- type MessagesPage
- type SenMLMessageRepository
- type SenMLMessagesPage
- type SenMLPageMetadata
- type Service
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" // AggregationSum represents the sum aggregation key. AggregationSum = "sum" // AggregationFirst represents the first-in-bucket aggregation key. AggregationFirst = "first" // AggregationLast represents the last-in-bucket aggregation key. AggregationLast = "last" )
Variables ¶
View Source
var ErrReadMessages = errors.New("failed to read messages from database")
ErrReadMessages indicates failure occurred while reading messages from database.
Functions ¶
func ComparatorSymbol ¶ added in v0.36.0
ComparatorSymbol converts a comparison operator key into its SQL symbol.
func ParseValueComparator ¶
ParseValueComparator converts comparison operator keys into mathematical notation.
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 = domain.JSONMessagesPage
Domain type aliases
type JSONPageMetadata ¶ added in v0.30.0
type JSONPageMetadata = domain.JSONPageMetadata
Domain type aliases
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 = domain.SenMLMessagesPage
Domain type aliases
type SenMLPageMetadata ¶ added in v0.30.0
type SenMLPageMetadata = domain.SenMLPageMetadata
Domain type aliases
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 domain.ThingKey, rpm JSONPageMetadata) (JSONMessagesPage, error)
// ListSenMLMessages retrieves the senml messages with given filters.
ListSenMLMessages(ctx context.Context, token string, key domain.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 domain.AuthClient, things domain.ThingsClient, json JSONMessageRepository, senml SenMLMessageRepository) Service
Directories
¶
| Path | Synopsis |
|---|---|
|
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.