storage

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: 3 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")
	ErrCannotGetAppURL       = errors.New("cannot get app url")

	ErrIDNotFound          = errors.New("entity id not found")
	ErrIDAlreadyExists     = errors.New("entity id already exists")
	ErrEntityNotFound      = errors.New("entity not found")
	ErrSensorNotFound      = errors.New("sensor not found")
	ErrImageNotFound       = errors.New("image not found")
	ErrFlowerbedNotFound   = errors.New("flowerbed not found")
	ErrTreeClusterNotFound = errors.New("treecluster not found")
	ErrRegionNotFound      = errors.New("region not found")
	ErrTreeNotFound        = errors.New("tree not found")

	ErrUnknowError      = errors.New("unknown error")
	ErrToManyRows       = errors.New("receive more rows then expected")
	ErrConnectionClosed = errors.New("connection is closed")
	ErrTxClosed         = errors.New("transaction closed")
	ErrTxCommitRollback = errors.New("transaction cannot commit or rollback")
)

Functions

This section is empty.

Types

type AuthRepository

type AuthRepository interface {
	RetrospectToken(ctx context.Context, token string) (*entities.IntroSpectTokenResult, error)
	GetAccessTokenFromClientCode(ctx context.Context, code, redirectURL string) (*entities.ClientToken, error)
	RefreshToken(ctx context.Context, refreshToken string) (*entities.ClientToken, error)
}

type BasicCrudRepository

type BasicCrudRepository[T entities.Entities] interface {
	GetAll(ctx context.Context) ([]*T, error)
	GetByID(ctx context.Context, id int32) (*T, error)

	Create(ctx context.Context, fn ...entities.EntityFunc[T]) (*T, error)
	Update(ctx context.Context, id int32, fn ...entities.EntityFunc[T]) (*T, error)
	Delete(ctx context.Context, id int32) error
}

type FlowerbedRepository

type FlowerbedRepository interface {
	BasicCrudRepository[entities.Flowerbed]
	GetSensorByFlowerbedID(ctx context.Context, id int32) (*entities.Sensor, error)
	GetAllImagesByID(ctx context.Context, id int32) ([]*entities.Image, error)

	CreateAndLinkImages(ctx context.Context, fFn ...entities.EntityFunc[entities.Flowerbed]) (*entities.Flowerbed, error)
	UpdateWithImages(ctx context.Context, id int32, fFn ...entities.EntityFunc[entities.Flowerbed]) (*entities.Flowerbed, error)
	DeleteAndUnlinkImages(ctx context.Context, id int32) error
	UnlinkAllImages(ctx context.Context, id int32) error
	UnlinkImage(ctx context.Context, flowerbedID, imageID int32) error
	Archive(ctx context.Context, id int32) error
}

type ImageRepository

type ImageRepository interface {
	BasicCrudRepository[entities.Image]
}

type InfoRepository

type InfoRepository interface {
	GetAppInfo(context.Context) (*entities.App, error)
}

type RegionRepository

type RegionRepository interface {
	BasicCrudRepository[entities.Region]
	GetByName(ctx context.Context, name string) (*entities.Region, error)
	GetByPoint(ctx context.Context, latitude, longitude float64) (*entities.Region, error)
}

type RoleRepository

type RoleRepository interface {
	GetByName(ctx context.Context, name string) (*entities.Role, error)
}

type SensorRepository

type SensorRepository interface {
	BasicCrudRepository[entities.Sensor]
	GetStatusByID(ctx context.Context, id int32) (*entities.SensorStatus, error)
	GetSensorByStatus(ctx context.Context, status *entities.SensorStatus) ([]*entities.Sensor, error)
	GetSensorDataByID(ctx context.Context, id int32) ([]*entities.SensorData, error)
	InsertSensorData(ctx context.Context, data []*entities.SensorData) ([]*entities.SensorData, error)
}

type TreeClusterRepository

type TreeClusterRepository interface {
	BasicCrudRepository[entities.TreeCluster]
	GetSensorByTreeClusterID(ctx context.Context, id int32) (*entities.Sensor, error)
	Archive(ctx context.Context, id int32) error
	LinkTreesToCluster(ctx context.Context, treeClusterID int32, treeIDs []int32) error
	GetByAddress(ctx context.Context, address string) (*entities.TreeCluster, error)
}

type TreeRepository

type TreeRepository interface {
	BasicCrudRepository[entities.Tree]
	GetByTreeClusterID(ctx context.Context, id int32) ([]*entities.Tree, error)
	GetAllImagesByID(ctx context.Context, id int32) ([]*entities.Image, error)
	GetSensorByTreeID(ctx context.Context, id int32) (*entities.Sensor, error)
	GetTreesByIDs(ctx context.Context, ids []int32) ([]*entities.Tree, error)
	GetByCoordinates(ctx context.Context, latitude, longitude float64) (*entities.Tree, error)

	UpdateWithImages(ctx context.Context, id int32, fFn ...entities.EntityFunc[entities.Tree]) (*entities.Tree, error)
	DeleteAndUnlinkImages(ctx context.Context, id int32) error
	UnlinkAllImages(ctx context.Context, id int32) error
	UnlinkTreeClusterID(ctx context.Context, treeClusterID int32) error
	UnlinkImage(ctx context.Context, flowerbedID, imageID int32) error
	CreateAndLinkImages(ctx context.Context, tcFn ...entities.EntityFunc[entities.Tree]) (*entities.Tree, error)
	GetCenterPoint(ctx context.Context, id []int32) (float64, float64, error)
}

type UserRepository

type UserRepository interface {
	Create(ctx context.Context, user *entities.User, password string, roles *[]string) (*entities.User, error)
	GetByAccessToken(ctx context.Context, token string) (*entities.User, error)
	RemoveSession(ctx context.Context, token string) error
}

type VehicleRepository

type VehicleRepository interface {
	BasicCrudRepository[entities.Vehicle]
	GetByPlate(ctx context.Context, plate string) (*entities.Vehicle, error)
}

Jump to

Keyboard shortcuts

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