entity

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSensorNotFound = errors.New("sensor not found")
)

Functions

This section is empty.

Types

type Param

type Param struct {
	Min    int     `json:"min"`
	Max    int     `json:"max"`
	Factor float64 `json:"z"`
}

type Sensor

type Sensor struct {
	Id        primitive.ObjectID `bson:"_id" json:"id"`
	Name      string             `json:"name"`
	Latitude  float64            `json:"latitude"`
	Longitude float64            `json:"longitude"`
	Params    map[string]Param   `json:"params"`
}

func NewSensor

func NewSensor(name string, latitude float64, longitude float64, params map[string]Param) *Sensor

func (*Sensor) Validate

func (s *Sensor) Validate() error

type SensorRepository

type SensorRepository interface {
	CreateSensor(ctx context.Context, sensor *Sensor) (*Sensor, error)
	FindSensorById(ctx context.Context, id primitive.ObjectID) (*Sensor, error)
	FindAllSensors(ctx context.Context) ([]*Sensor, error)
}

Jump to

Keyboard shortcuts

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