Documentation
¶
Index ¶
- Variables
- func MapError(ctx context.Context, err error, errorMask ErrorLogMask) error
- type AuthService
- type BasicCrudService
- type CrudService
- type Error
- type ErrorCode
- type ErrorLogMask
- type EvaluationService
- type InfoService
- type PluginService
- type RegionService
- type SensorService
- type Service
- type Services
- type ServicesInterface
- type TreeClusterService
- type TreeService
- type VehicleService
- type WateringPlanService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIPNotFound = errors.New("local ip not found") ErrIFacesNotFound = errors.New("cant get interfaces") ErrIFacesAddressNotFound = errors.New("cant get interfaces address") ErrHostnameNotFound = errors.New("cant get hostname") ErrValidation = errors.New("validation error") ErrPluginRegistered = NewError(BadRequest, "plugin already registered") ErrPluginNotRegistered = NewError(BadRequest, "plugin not registered") ErrVehiclePlateTaken = NewError(BadRequest, "number plate is already taken") ErrVehicleUnsupportedType = NewError(BadRequest, "vehicle type is not supported") ErrUserNotCorrectRole = NewError(BadRequest, "user has an incorrect role") )
Functions ¶
Types ¶
type AuthService ¶
type AuthService interface { Service LoginRequest(ctx context.Context, loginRequest *domain.LoginRequest) *domain.LoginResp LogoutRequest(ctx context.Context, logoutRequest *domain.Logout) error ClientTokenCallback(ctx context.Context, loginCallback *domain.LoginCallback) (*domain.ClientToken, error) Register(ctx context.Context, user *domain.RegisterUser) (*domain.User, error) RetrospectToken(ctx context.Context, token string) (*domain.IntroSpectTokenResult, error) RefreshToken(ctx context.Context, refreshToken string) (*domain.ClientToken, error) GetAll(ctx context.Context) ([]*domain.User, error) GetByIDs(ctx context.Context, ids []string) ([]*domain.User, error) GetAllByRole(ctx context.Context, role domain.UserRole) ([]*domain.User, error) }
type BasicCrudService ¶
type BasicCrudService[T any, CreateType any, UpdateType any] interface { GetAll(ctx context.Context, query domain.Query) ([]*T, int64, error) GetByID(ctx context.Context, id int32) (*T, error) Create(ctx context.Context, createData *CreateType) (*T, error) Update(ctx context.Context, id int32, updateData *UpdateType) (*T, error) Delete(ctx context.Context, id int32) error }
type CrudService ¶
type CrudService[T any, CreateType any, UpdateType any] interface { Service BasicCrudService[T, CreateType, UpdateType] }
type ErrorLogMask ¶
type ErrorLogMask int
const ( ErrorLogNothing ErrorLogMask = -1 ErrorLogAll ErrorLogMask = 0 ErrorLogEntityNotFound ErrorLogMask = (1 << iota) ErrorLogValidation )
Bitmask
type EvaluationService ¶
type InfoService ¶
type PluginService ¶
type PluginService interface { Service Register(ctx context.Context, plugin *domain.Plugin) (*domain.ClientToken, error) RefreshToken(ctx context.Context, auth *domain.AuthPlugin, slug string) (*domain.ClientToken, error) Get(ctx context.Context, slug string) (domain.Plugin, error) GetAll(ctx context.Context) ([]domain.Plugin, []time.Time) HeartBeat(ctx context.Context, slug string) error Unregister(ctx context.Context, slug string) StartCleanup(ctx context.Context) }
type RegionService ¶
type SensorService ¶
type SensorService interface { Service GetAll(ctx context.Context, query domain.Query) ([]*domain.Sensor, int64, error) GetByID(ctx context.Context, id string) (*domain.Sensor, error) Create(ctx context.Context, createData *domain.SensorCreate) (*domain.Sensor, error) Update(ctx context.Context, id string, updateData *domain.SensorUpdate) (*domain.Sensor, error) Delete(ctx context.Context, id string) error GetAllDataByID(ctx context.Context, id string) ([]*domain.SensorData, error) HandleMessage(ctx context.Context, payload *domain.MqttPayload) (*domain.SensorData, error) MapSensorToTree(ctx context.Context, sen *domain.Sensor) error UpdateStatuses(ctx context.Context) error }
type Services ¶
type Services struct { InfoService InfoService TreeService TreeService AuthService AuthService RegionService RegionService TreeClusterService TreeClusterService SensorService SensorService VehicleService VehicleService PluginService PluginService WateringPlanService WateringPlanService EvaluationService EvaluationService }
func (*Services) AllServicesReady ¶
type ServicesInterface ¶
type ServicesInterface interface {
AllServicesReady() bool
}
type TreeClusterService ¶
type TreeClusterService interface { Service // TODO: use CrudService as soon as every service has pagination // CrudService[domain.TreeCluster, domain.TreeClusterCreate, domain.TreeClusterUpdate] GetAll(ctx context.Context, query domain.TreeClusterQuery) ([]*domain.TreeCluster, int64, error) GetByID(ctx context.Context, id int32) (*domain.TreeCluster, error) Create(ctx context.Context, createData *domain.TreeClusterCreate) (*domain.TreeCluster, error) Update(ctx context.Context, id int32, updateData *domain.TreeClusterUpdate) (*domain.TreeCluster, error) Delete(ctx context.Context, id int32) error HandleUpdateTree(context.Context, *domain.EventUpdateTree) error HandleCreateTree(context.Context, *domain.EventCreateTree) error HandleDeleteTree(context.Context, *domain.EventDeleteTree) error HandleNewSensorData(context.Context, *domain.EventNewSensorData) error HandleUpdateWateringPlan(context.Context, *domain.EventUpdateWateringPlan) error UpdateWateringStatuses(ctx context.Context) error }
type TreeService ¶
type TreeService interface { Service GetAll(ctx context.Context, query domain.TreeQuery) ([]*domain.Tree, int64, error) GetByID(ctx context.Context, id int32) (*domain.Tree, error) Create(ctx context.Context, createData *domain.TreeCreate) (*domain.Tree, error) Update(ctx context.Context, id int32, updateData *domain.TreeUpdate) (*domain.Tree, error) Delete(ctx context.Context, id int32) error GetBySensorID(ctx context.Context, id string) (*domain.Tree, error) HandleNewSensorData(context.Context, *domain.EventNewSensorData) error UpdateWateringStatuses(ctx context.Context) error }
type VehicleService ¶
type VehicleService interface { Service GetAll(ctx context.Context, query domain.VehicleQuery) ([]*domain.Vehicle, int64, error) GetAllArchived(ctx context.Context) ([]*domain.Vehicle, error) GetByID(ctx context.Context, id int32) (*domain.Vehicle, error) Create(ctx context.Context, createData *domain.VehicleCreate) (*domain.Vehicle, error) Update(ctx context.Context, id int32, updateData *domain.VehicleUpdate) (*domain.Vehicle, error) Delete(ctx context.Context, id int32) error Archive(ctx context.Context, id int32) error GetByPlate(ctx context.Context, plate string) (*domain.Vehicle, error) }
type WateringPlanService ¶
type WateringPlanService interface { Service GetAll(ctx context.Context, query domain.Query) ([]*domain.WateringPlan, int64, error) GetByID(ctx context.Context, id int32) (*domain.WateringPlan, error) Create(ctx context.Context, createData *domain.WateringPlanCreate) (*domain.WateringPlan, error) Update(ctx context.Context, id int32, updateData *domain.WateringPlanUpdate) (*domain.WateringPlan, error) Delete(ctx context.Context, id int32) error PreviewRoute(ctx context.Context, transporterID int32, trailerID *int32, clusterIDs []int32) (*domain.GeoJSON, error) GetGPXFileStream(ctx context.Context, objName string) (io.ReadSeekCloser, error) UpdateStatuses(ctx context.Context) error }
Click to show internal directories.
Click to hide internal directories.