Documentation ¶
Index ¶
- type DeviceRepositoryInterface
- type Service
- func (s *Service) Create(ctx context.Context, w *domain.DeviceRequest) error
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) GetAll(ctx context.Context, page, limit int) ([]domain.Device, error)
- func (s *Service) GetByID(ctx context.Context, id string) (*domain.Device, error)
- func (s *Service) Update(ctx context.Context, w *domain.Device) error
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 ¶
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 ¶
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 ¶
GetAll retrieves all waste water data with pagination.
ctx context.Context, page int, limit int []domain.DeviceData, error