mongo

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: 8 Imported by: 0

Documentation

Index

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

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

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

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

func (r *DeviceRepository) GetByID(ctx context.Context, id string) (*domain.Device, 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 (*DeviceRepository) Update

func (r *DeviceRepository) Update(ctx context.Context, w *domain.Device) error

Update updates a WasteWaterData in the DeviceRepository.

ctx: the context for the operation. w: a pointer to the WasteWaterData to update.

Returns an error if the operation was not successful.

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

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

func (r *SensorRepository) GetAll(ctx context.Context, page, limit int) ([]domain.Sensor, error)

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

func (r *SensorRepository) GetByID(ctx context.Context, id string) (*domain.Sensor, 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 (*SensorRepository) Update

func (r *SensorRepository) Update(ctx context.Context, w *domain.Sensor) error

Update updates a WasteWaterData in the SensorRepository.

ctx: the context for the operation. w: a pointer to the WasteWaterData to update.

Returns an error if the operation was not successful.

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

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

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

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.

Jump to

Keyboard shortcuts

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