Documentation ¶
Index ¶
- type DeviceRepository
- func (r *DeviceRepository) Create(ctx context.Context, w *domain.DeviceRequest) error
- func (r *DeviceRepository) Delete(ctx context.Context, id string) error
- func (r *DeviceRepository) GetAll(ctx context.Context, page, limit int) ([]domain.Device, error)
- func (r *DeviceRepository) GetByID(ctx context.Context, id string) (*domain.Device, error)
- func (r *DeviceRepository) Update(ctx context.Context, w *domain.Device) error
- type SensorRepository
- func (r *SensorRepository) Create(ctx context.Context, w *domain.SensorRequest) error
- func (r *SensorRepository) Delete(ctx context.Context, id string) error
- func (r *SensorRepository) GetAll(ctx context.Context, page, limit int) ([]domain.Sensor, error)
- func (r *SensorRepository) GetByID(ctx context.Context, id string) (*domain.Sensor, error)
- func (r *SensorRepository) Update(ctx context.Context, w *domain.Sensor) error
- type WasteWaterRepository
- func (r *WasteWaterRepository) Create(ctx context.Context, w *domain.WastewaterDataRequest) error
- func (r *WasteWaterRepository) Delete(ctx context.Context, id string) error
- func (r *WasteWaterRepository) GetAll(ctx context.Context, page, limit int) ([]domain.WasteWaterData, error)
- func (r *WasteWaterRepository) GetByID(ctx context.Context, id string) (*domain.WasteWaterData, error)
- func (r *WasteWaterRepository) Update(ctx context.Context, w *domain.WasteWaterData) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceRepository ¶
type DeviceRepository struct {
// contains filtered or unexported fields
}
DeviceRepository is the implementation of the DeviceRepositoryInterface.
func NewDeviceRepository ¶
func NewDeviceRepository(client *mongo.Client, config *config.MongoConfig) *DeviceRepository
NewDeviceRepository creates a new DeviceRepository.
The DeviceRepository is used to interact with the waste water collection in the database.
Parameters: - client: a pointer to a mongo.Client. - config: a pointer to a config.MongoConfig. Returns a pointer to a DeviceRepository.
func (*DeviceRepository) Create ¶
func (r *DeviceRepository) Create(ctx context.Context, w *domain.DeviceRequest) error
Create adds a new waste water record to the database.
ctx: the context in which the operation is performed. w: the waste water data request to be stored.
Returns an error if the operation was not successful.
func (*DeviceRepository) Delete ¶
func (r *DeviceRepository) Delete(ctx context.Context, id string) error
Delete removes a single document from the DeviceRepository collection using the provided context and ID. If the ID is not found, it returns a MongoDB exception with the NotFound error code. It returns an error if any other error occurs.
func (*DeviceRepository) GetAll ¶
GetAll retrieves all waste water data with pagination from the DeviceRepository.
ctx: the context for the operation. page: the page number for pagination. limit: the maximum number of items to return per page.
Returns a list of waste water data and an error, if any.
func (*DeviceRepository) GetByID ¶
GetByID retrieves a WasteWaterData document by its ID.
Parameters:
ctx - context.Context: the context for the operation id - string: the ID of the document to retrieve
Returns:
*domain.WasteWaterData - pointer to the retrieved WasteWaterData error - nil if successful, error if not found or any other error occurs
type SensorRepository ¶
type SensorRepository struct {
// contains filtered or unexported fields
}
SensorRepository is the implementation of the SensorRepositoryInterface.
func NewSensorRepository ¶
func NewSensorRepository(client *mongo.Client, config *config.MongoConfig) *SensorRepository
NewSensorRepository creates a new SensorRepository.
The SensorRepository is used to interact with the waste water collection in the database.
Parameters: - client: a pointer to a mongo.Client. - config: a pointer to a config.MongoConfig. Returns a pointer to a SensorRepository.
func (*SensorRepository) Create ¶
func (r *SensorRepository) Create(ctx context.Context, w *domain.SensorRequest) error
Create adds a new waste water record to the database.
ctx: the context in which the operation is performed. w: the waste water data request to be stored.
Returns an error if the operation was not successful.
func (*SensorRepository) Delete ¶
func (r *SensorRepository) Delete(ctx context.Context, id string) error
Delete removes a single document from the SensorRepository collection using the provided context and ID. If the ID is not found, it returns a MongoDB exception with the NotFound error code. It returns an error if any other error occurs.
func (*SensorRepository) GetAll ¶
GetAll retrieves all waste water data with pagination from the SensorRepository.
ctx: the context for the operation. page: the page number for pagination. limit: the maximum number of items to return per page.
Returns a list of waste water data and an error, if any.
func (*SensorRepository) GetByID ¶
GetByID retrieves a WasteWaterData document by its ID.
Parameters:
ctx - context.Context: the context for the operation id - string: the ID of the document to retrieve
Returns:
*domain.WasteWaterData - pointer to the retrieved WasteWaterData error - nil if successful, error if not found or any other error occurs
type WasteWaterRepository ¶
type WasteWaterRepository struct {
// contains filtered or unexported fields
}
WasteWaterRepository is the implementation of the WasteWaterRepositoryInterface.
func NewWasteWaterRepository ¶
func NewWasteWaterRepository(client *mongo.Client, config *config.MongoConfig) *WasteWaterRepository
NewWasteWaterRepository creates a new WasteWaterRepository.
The WasteWaterRepository is used to interact with the waste water collection in the database.
Parameters: - client: a pointer to a mongo.Client. - config: a pointer to a config.MongoConfig. Returns a pointer to a WasteWaterRepository.
func (*WasteWaterRepository) Create ¶
func (r *WasteWaterRepository) Create(ctx context.Context, w *domain.WastewaterDataRequest) error
Create adds a new waste water record to the database.
ctx: the context in which the operation is performed. w: the waste water data request to be stored.
Returns an error if the operation was not successful.
func (*WasteWaterRepository) Delete ¶
func (r *WasteWaterRepository) Delete(ctx context.Context, id string) error
Delete removes a single document from the WasteWaterRepository collection using the provided context and ID. If the ID is not found, it returns a MongoDB exception with the NotFound error code. It returns an error if any other error occurs.
func (*WasteWaterRepository) GetAll ¶
func (r *WasteWaterRepository) GetAll(ctx context.Context, page, limit int) ([]domain.WasteWaterData, error)
GetAll retrieves all waste water data with pagination from the WasteWaterRepository.
ctx: the context for the operation. page: the page number for pagination. limit: the maximum number of items to return per page.
Returns a list of waste water data and an error, if any.
func (*WasteWaterRepository) GetByID ¶
func (r *WasteWaterRepository) GetByID(ctx context.Context, id string) (*domain.WasteWaterData, error)
GetByID retrieves a WasteWaterData document by its ID.
Parameters:
ctx - context.Context: the context for the operation id - string: the ID of the document to retrieve
Returns:
*domain.WasteWaterData - pointer to the retrieved WasteWaterData error - nil if successful, error if not found or any other error occurs
func (*WasteWaterRepository) Update ¶
func (r *WasteWaterRepository) Update(ctx context.Context, w *domain.WasteWaterData) error
Update updates a WasteWaterData in the WasteWaterRepository.
ctx: the context for the operation. w: a pointer to the WasteWaterData to update.
Returns an error if the operation was not successful.