service

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSensorMetadataService

func NewSensorMetadataService(uri, databaseName string) (*sensorMetadataService, error)

Types

type Location

type Location struct {
	Lat string `json:"lat"`
	Lon string `json:"lon"`
}

Location represents a location with lat and lon

type SensorMetadata

type SensorMetadata struct {
	ID       string    `json:"id,omitempty"`
	Name     string    `json:"name"`
	Location *Location `json:"location,omitempty"`
	Tags     []string  `json:"tags"`
}

SensorMetadata represents a sensor metadata DTO

func FromDatabaseToSensorMetadata

func FromDatabaseToSensorMetadata(mobj db.Sensor) *SensorMetadata

FromDatabaseToSensorMetadata converts the mongo datq structure to the DTO

func (SensorMetadata) ToDatabase

func (s SensorMetadata) ToDatabase() (*db.Sensor, error)

ToDatabase converts sensor meta-data to the database format

type SensorMetadataService

type SensorMetadataService interface {
	FindByName(ctx context.Context, name string) (sensor *SensorMetadata, err error)
	FindByID(ctx context.Context, id string) (sensor *SensorMetadata, err error)
	Add(ctx context.Context, sensor SensorMetadata) (id string, err error)
	Update(ctx context.Context, sensor SensorMetadata) (err error)
	Delete(ctx context.Context, id string) (err error)
	FindNearest(ctx context.Context, lat, lon string) (sensor *SensorMetadata, err error)
}

SensorMetadataService is the interface to the provided services

Jump to

Keyboard shortcuts

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