sensor etc added

This commit is contained in:
geek
2017-06-09 16:28:21 +09:00
parent aefe450b95
commit 674c5dcedb
4 changed files with 35 additions and 48 deletions

View File

@@ -2,32 +2,31 @@ package sensorItem
import (
"encoding/json"
"github.com/golang/protobuf/ptypes/timestamp"
"git.loafle.net/overflow/crawler_go"
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensorItemCategory"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
"git.loafle.net/overflow/overflow_proxy_service/proxy/target"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
"github.com/golang/protobuf/ptypes/timestamp"
)
type SensorItem struct {
Id json.Number `json:"id,Number,omitempty"`
Crawler crawler.Crawler `json:"crawler,omitempty"`
SensorItemCategory sensorItemCategory.SensorItemCategory `json:"sensorItemCategory,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DataType string `json:"dataType,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
Id json.Number `json:"id,Number,omitempty"`
Crawler crawler.Crawler `json:"crawler,omitempty"`
SensorItemCategory sensorItemCategory.SensorItemCategory `json:"sensorItemCategory,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DataType string `json:"dataType,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorItemService struct {
}
func NewSensorItemService() (*SensorItemService) {
func NewSensorItemService() *SensorItemService {
return &SensorItemService{}
}
func (sis *SensorItemService) Create(si *SensorItem) (string, error){
func (sis *SensorItemService) Create(si *SensorItem) (string, error) {
out, err := utils.InvokeDB("sensorItem", "create", si)
if err != nil {
@@ -36,9 +35,7 @@ func (sis *SensorItemService) Create(si *SensorItem) (string, error){
return out, nil
}
func (ss *SensorItemService)List(cr *crawler.Crawler) (string, error) {
func (ss *SensorItemService) List(cr *crawler.Crawler) (string, error) {
out, err := utils.InvokeDBByModel("sensorItem", "findAllByCrawlerId", cr, "com.loafle.overflow.crawler.model.Crawler")
@@ -46,7 +43,6 @@ func (ss *SensorItemService)List(cr *crawler.Crawler) (string, error) {
return "", err
}
return out, nil
return out, nil;
}
}