Documentation
¶
Index ¶
- 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 Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 Repository ¶
type Repository interface { // ListAllMeters returns a list of meters. ListAllMeters(ctx context.Context) ([]models.Meter, error) // ListMeters returns a list of meters for the given namespace. ListMeters(ctx context.Context, namespace string) ([]models.Meter, error) // GetMeterByIDOrSlug returns a meter from the meter store by ID or slug. GetMeterByIDOrSlug(ctx context.Context, namespace string, idOrSlug string) (models.Meter, error) }
Repository is an interface to the meter store.
Click to show internal directories.
Click to hide internal directories.