service

package
v0.0.0-...-a1584db Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service connects database and API

func NewService

func NewService(db *database.Database) *Service

NewService creates new service singleton object

func (*Service) CreateAlarm

func (service *Service) CreateAlarm(alarmForm *apiModel.AlarmForm) (*string, error)

CreateAlarm in database and return its ID to API

func (*Service) DeleteAlarm

func (service *Service) DeleteAlarm(alarmID string) error

DeleteAlarm by deviceID

func (*Service) DeleteNearestAlarm

func (service *Service) DeleteNearestAlarm(deviceID string) error

DeleteNearestAlarm by deviceID

func (*Service) GetAlarm

func (service *Service) GetAlarm(alarmID string) (*apiModel.AlarmForm, error)

GetAlarm by id from database and return to API

func (*Service) GetAlarmsByDevice

func (service *Service) GetAlarmsByDevice(deviceID string) ([]*apiModel.AlarmForm, error)

GetAlarmsByDevice get alarms by device

func (*Service) GetDevice

func (service *Service) GetDevice(deviceID string) (*apiModel.DeviceForm, error)

GetDevice by id from database and return to API

func (*Service) GetDevices

func (service *Service) GetDevices() ([]*apiModel.DeviceForm, error)

GetDevices get every device in db

func (*Service) GetNearestAlarmByDevice

func (service *Service) GetNearestAlarmByDevice(deviceID string) (*apiModel.AlarmForm, error)

GetNearestAlarmByDevice get first alarm to ring

func (*Service) GetStatistics

func (service *Service) GetStatistics(deviceID string, dateFrom string, dateTo string, dataType string) ([]*apiModel.StatisticForm, error)

GetStatistics by id from database and return to API

func (*Service) GetStatisticsTypes

func (service *Service) GetStatisticsTypes(deviceID string) ([]string, error)

GetStatisticsTypes by deviceID

func (*Service) InsertStatistic

func (service *Service) InsertStatistic(statisticForm *apiModel.StatisticForm) error

InsertStatistic from api to db

func (*Service) RegisterDevice

func (service *Service) RegisterDevice(deviceForm *apiModel.DeviceForm) (*string, error)

RegisterDevice in database and return its ID to API

Jump to

Keyboard shortcuts

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