Documentation ¶
Index ¶
- Variables
- func EventKey(id string) string
- func MeterKey(id string) string
- type Domain
- type Impl
- func (d *Impl) AddMeterToConsume(meter *entities.Meter)
- func (d *Impl) DeleteMeter(ctx context.Context, id string) error
- func (d *Impl) GetMeter(ctx context.Context, id string) (*entities.Meter, error)
- func (d *Impl) GetReading(ctx context.Context, key string) (*entities.Reading, error)
- func (d *Impl) ListMeters(ctx context.Context) ([]kv.Entry[*entities.Meter], error)
- func (d *Impl) ListReadings(ctx context.Context, pattern string) ([]kv.Entry[*entities.Reading], error)
- func (d *Impl) RegisterMeter(ctx context.Context, meter entities.Meter) error
- func (d *Impl) RemoveMeterFromConsume(key string)
- func (d *Impl) StartConsumingEvents(ctx context.Context) error
- type MeterMap
- type MeterProducer
Constants ¶
This section is empty.
Variables ¶
View Source
var MeterAlreadyExistError = errors.New("meter already exist")
View Source
var Module = fx.Module("domain", fx.Provide(func(e *env.Env, meterRepo kv.Repo[*entities.Meter], readingsRepo kv.Repo[*entities.Reading], logger logging.Logger, jc *nats.JetstreamClient, env *env.Env, meterProducer MeterProducer, ) (Domain, error) { return &Impl{ meterRepo: meterRepo, readingsRepo: readingsRepo, logger: logger, meterMap: MeterMap{}, oldMeterMap: MeterMap{}, jc: jc, env: env, meterProducer: meterProducer, }, nil }))
Functions ¶
Types ¶
type Domain ¶
type Domain interface { RegisterMeter(ctx context.Context, meter entities.Meter) error ListMeters(ctx context.Context) ([]kv.Entry[*entities.Meter], error) DeleteMeter(ctx context.Context, key string) error GetMeter(ctx context.Context, key string) (*entities.Meter, error) GetReading(ctx context.Context, key string) (*entities.Reading, error) ListReadings(ctx context.Context, pattern string) ([]kv.Entry[*entities.Reading], error) StartConsumingEvents(ctx context.Context) error AddMeterToConsume(meter *entities.Meter) RemoveMeterFromConsume(key string) }
type Impl ¶
type Impl struct {
// contains filtered or unexported fields
}
func (*Impl) AddMeterToConsume ¶
func (*Impl) GetReading ¶
func (*Impl) ListMeters ¶
func (*Impl) ListReadings ¶
func (*Impl) RegisterMeter ¶
func (*Impl) RemoveMeterFromConsume ¶
type MeterMap ¶
func (MeterMap) RemoveMeter ¶
type MeterProducer ¶
Click to show internal directories.
Click to hide internal directories.