Documentation
¶
Index ¶
- Constants
- func ValidateEvent(meter Meter, ev event.Event) error
- type InMemoryRepository
- func (c *InMemoryRepository) GetMeterByIDOrSlug(_ context.Context, namespace string, idOrSlug string) (models.Meter, error)
- func (c *InMemoryRepository) ListAllMeters(_ context.Context) ([]models.Meter, error)
- func (c *InMemoryRepository) ListMeters(_ context.Context, namespace string) ([]models.Meter, error)
- type Meter
- type MeterAggregation
- type Repository
- type WindowSize
Constants ¶
View Source
const ( MeterAggregationSum = models.MeterAggregationSum MeterAggregationCount = models.MeterAggregationCount MeterAggregationAvg = models.MeterAggregationAvg MeterAggregationMin = models.MeterAggregationMin MeterAggregationMax = models.MeterAggregationMax MeterAggregationUniqueCount = models.MeterAggregationUniqueCount )
View Source
const ( WindowSizeMinute = models.WindowSizeMinute WindowSizeHour = models.WindowSizeHour WindowSizeDay = models.WindowSizeDay )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InMemoryRepository ¶
type InMemoryRepository struct {
// contains filtered or unexported fields
}
InMemoryRepository is an in-memory meter repository.
func NewInMemoryRepository ¶
func NewInMemoryRepository(meters []models.Meter) *InMemoryRepository
NewInMemoryRepository returns a in-memory meter repository.
func (*InMemoryRepository) GetMeterByIDOrSlug ¶
func (c *InMemoryRepository) GetMeterByIDOrSlug(_ context.Context, namespace string, idOrSlug string) (models.Meter, error)
GetMeterByIDOrSlug implements the Repository interface.
func (*InMemoryRepository) ListAllMeters ¶
ListMeters implements the Repository interface.
func (*InMemoryRepository) ListMeters ¶
func (c *InMemoryRepository) ListMeters(_ context.Context, namespace string) ([]models.Meter, error)
ListMeters implements the Repository interface.
type MeterAggregation ¶
type MeterAggregation = models.MeterAggregation
type Repository ¶
type Repository interface { // ListAllMeters returns a list of meters. ListAllMeters(ctx context.Context) ([]Meter, error) // ListMeters returns a list of meters for the given namespace. ListMeters(ctx context.Context, namespace string) ([]Meter, error) // GetMeterByIDOrSlug returns a meter from the meter store by ID or slug. GetMeterByIDOrSlug(ctx context.Context, namespace string, idOrSlug string) (Meter, error) }
Repository is an interface to the meter store.
type WindowSize ¶
type WindowSize = models.WindowSize
Click to show internal directories.
Click to hide internal directories.