adapter

package
v1.0.0-beta.210 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapFromEntityFactory

func MapFromEntityFactory(entity *db.Meter) (meter.Meter, error)

MapFromEntityFactory creates a function that maps a meter db entity to a meter model.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Adapter, error)

func (*Adapter) CreateMeter

func (a *Adapter) CreateMeter(ctx context.Context, input meterpkg.CreateMeterInput) (meterpkg.Meter, error)

CreateMeter creates a new meter.

func (*Adapter) DeleteMeter

func (a *Adapter) DeleteMeter(ctx context.Context, meter meterpkg.Meter) error

DeleteMeter deletes a meter.

func (*Adapter) GetMeterByIDOrSlug

func (a *Adapter) GetMeterByIDOrSlug(ctx context.Context, input meter.GetMeterInput) (meter.Meter, error)

GetMeterByIDOrSlug returns a meter from the meter store by ID or slug.

func (*Adapter) ListMeters

ListMeters returns a list of meters.

func (*Adapter) Self

func (a *Adapter) Self() *Adapter

func (*Adapter) Tx

Tx implements entutils.TxCreator interface

func (*Adapter) UpdateMeter

func (a *Adapter) UpdateMeter(ctx context.Context, input meterpkg.UpdateMeterInput) (meterpkg.Meter, error)

UpdateMeter updates a new meter.

func (*Adapter) WithTx

func (a *Adapter) WithTx(ctx context.Context, tx *entutils.TxDriver) *Adapter

type Config

type Config struct {
	Client *db.Client
	Logger *slog.Logger
}

func (Config) Validate

func (c Config) Validate() error

Jump to

Keyboard shortcuts

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