meter

package
v1.0.0-beta.76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

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

func (c *InMemoryRepository) ListAllMeters(_ context.Context) ([]models.Meter, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL