service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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")
)

Functions

This section is empty.

Types

type AuthService

type AuthService interface {
	Service
	LoginRequest(ctx context.Context, loginRequest *domain.LoginRequest) (*domain.LoginResp, error)
	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)
}

type Error

type Error struct {
	Message string
	Code    ErrorCode
}

func NewError

func NewError(code ErrorCode, msg string) Error

func (Error) Error

func (e Error) Error() string

type ErrorCode

type ErrorCode int
const (
	BadRequest    ErrorCode = 400
	Unauthorized  ErrorCode = 401
	Forbidden     ErrorCode = 403
	NotFound      ErrorCode = 404
	InternalError ErrorCode = 500
)

type InfoService

type InfoService interface {
	Service
	GetAppInfo(context.Context) (*domain.App, error)
	GetAppInfoResponse(context.Context) (*domain.App, error)
}

type MqttService

type MqttService interface {
	Service
	HandleMessage(ctx context.Context, payload *domain.MqttPayload) (*domain.MqttPayload, error)
	SetConnected(bool)
}

type RegionService

type RegionService interface {
	Service
	GetAll(ctx context.Context) ([]*domain.Region, error)
	GetByID(ctx context.Context, id int32) (*domain.Region, error)
}

type SensorService

type SensorService interface {
	Service
	GetAll(ctx context.Context) ([]*domain.Sensor, error)
}

type Service

type Service interface {
	Ready() bool
}

type Services

type Services struct {
	InfoService        InfoService
	MqttService        MqttService
	TreeService        TreeService
	AuthService        AuthService
	RegionService      RegionService
	TreeClusterService TreeClusterService
	SensorService      SensorService
}

func (*Services) AllServicesReady

func (s *Services) AllServicesReady() bool

type TreeClusterService

type TreeClusterService interface {
	Service
	GetAll(ctx context.Context) ([]*domain.TreeCluster, error)
	GetByID(ctx context.Context, id int32) (*domain.TreeCluster, error)
	Create(ctx context.Context, tc *domain.TreeClusterCreate) (*domain.TreeCluster, error)
	Update(ctx context.Context, id int32, tc *domain.TreeClusterUpdate) (*domain.TreeCluster, error)
	Delete(ctx context.Context, id int32) error
}

type TreeService

type TreeService interface {
	Service
	ImportTree(ctx context.Context, trees []*domain.TreeImport) error

	GetAll(ctx context.Context) ([]*domain.Tree, error)
	GetByID(ctx context.Context, id int32) (*domain.Tree, error)
	Update(ctx context.Context, id int32, tc *domain.TreeUpdate) (*domain.Tree, error)
	Create(ctx context.Context, treeCreate *domain.TreeCreate) (*domain.Tree, error)
	Delete(ctx context.Context, id int32) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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