device

package
v0.0.0-...-60c21ee Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceRepositoryInterface

type DeviceRepositoryInterface interface {
	Create(ctx context.Context, w *domain.DeviceRequest) error
	GetAll(ctx context.Context, page, limit int) ([]domain.Device, error)
	GetByID(ctx context.Context, id string) (*domain.Device, error)
	Update(ctx context.Context, w *domain.Device) error
	Delete(ctx context.Context, id string) error
}

type Service

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

Service is the interface that wraps the Create, GetAll, GetByID, Update, and Delete methods.

func NewService

func NewService(deviceRepository DeviceRepositoryInterface) *Service

NewService creates a new instance of the Service struct, initializing it with the provided DeviceRepositoryInterface.

Parameters: - deviceRepository: The DeviceRepositoryInterface implementation used by the Service.

Returns: - A pointer to the newly created Service instance.

func (*Service) Create

func (s *Service) Create(ctx context.Context, w *domain.DeviceRequest) error

Create creates a new waste water data record in the service.

ctx: The context.Context object for the request. w: The waste water data to be created. Returns an error if there was a problem creating the record.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

Delete deletes a DeviceData by ID.

ctx - context.Context for the operation. id - string representing the ID of the data to be deleted. Returns an error if there was a problem deleting the data.

func (*Service) GetAll

func (s *Service) GetAll(ctx context.Context, page, limit int) ([]domain.Device, error)

GetAll retrieves all waste water data with pagination.

ctx context.Context, page int, limit int []domain.DeviceData, error

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, id string) (*domain.Device, error)

GetByID retrieves a DeviceData by ID.

ctx - context.Context for the operation. id - string representing the ID of the data. Returns a pointer to domain.DeviceData and an error.

func (*Service) Update

func (s *Service) Update(ctx context.Context, w *domain.Device) error

Update updates a DeviceData.

ctx - context.Context for the operation. w - pointer to domain.DeviceData representing the data to be updated. Returns an error if there was a problem updating the data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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