diff --git a/proxy/sensor/sensor.go b/proxy/sensor/sensor.go index dbca22f..c7517da 100644 --- a/proxy/sensor/sensor.go +++ b/proxy/sensor/sensor.go @@ -8,10 +8,10 @@ import ( ) type Sensor struct { - Id json.Number `json:"id,Number,omitempty"` - Target target.Target `json:"target,omitempty"` - Notification string `json:"notification,omitempty"` - CreateDate timestamp.Timestamp `json:"createDate,omitempty"` + Id json.Number `json:"id,Number,omitempty"` + Target target.Target `json:"target,omitempty"` + Notification string `json:"notification,omitempty"` + CreateDate timestamp.Timestamp `json:"createDate,omitempty"` } type SensorService struct { @@ -30,9 +30,7 @@ func (ss *SensorService) Create(s *Sensor) (string, error) { return out, nil } - -func (ss *SensorService)List(t *target.Target) (string, error) { - +func (ss *SensorService) List(t *target.Target) (string, error) { out, err := utils.InvokeDBByModel("sensor", "findAllByTargetId", t, "com.loafle.overflow.target.model.Target") @@ -40,7 +38,6 @@ func (ss *SensorService)List(t *target.Target) (string, error) { return "", err } - - return out, nil; + return out, nil } diff --git a/proxy/sensorItem/sensorItem.go b/proxy/sensorItem/sensorItem.go index 147d192..4c9850e 100644 --- a/proxy/sensorItem/sensorItem.go +++ b/proxy/sensorItem/sensorItem.go @@ -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; - -} \ No newline at end of file +} diff --git a/proxy/sensorItemCategory/sensorItemCategory.go b/proxy/sensorItemCategory/sensorItemCategory.go index 7435190..976e2cb 100644 --- a/proxy/sensorItemCategory/sensorItemCategory.go +++ b/proxy/sensorItemCategory/sensorItemCategory.go @@ -7,26 +7,24 @@ import ( ) type SensorItemCategory struct { - Id json.Number `json:"id,Number,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - CreateDate timestamp.Timestamp `json:"createDate,omitempty"` + Id json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + CreateDate timestamp.Timestamp `json:"createDate,omitempty"` } type SensorItemCategoryService struct { - } -func NewSensorItemCategoryService () (*SensorItemCategoryService ) { +func NewSensorItemCategoryService() *SensorItemCategoryService { return &SensorItemCategoryService{} } - -func (sics *SensorItemCategoryService) Create(sic *SensorItemCategory) (string, error){ +func (sics *SensorItemCategoryService) Create(sic *SensorItemCategory) (string, error) { out, err := utils.InvokeDB("sensorItemCategory", "create", sic) if err != nil { return "", err } return out, nil -} \ No newline at end of file +} diff --git a/proxy/sensorItemMapping/sensorItemMapping.go b/proxy/sensorItemMapping/sensorItemMapping.go index 6270f94..7e85156 100644 --- a/proxy/sensorItemMapping/sensorItemMapping.go +++ b/proxy/sensorItemMapping/sensorItemMapping.go @@ -9,17 +9,16 @@ import ( ) type SensorItemMapping struct { - Id json.Number `json:"id,Number,omitempty"` - Sensor sensor.Sensor `json:"sensor,omitempty"` - SensorItem sensorItem.SensorItem `json:"sensorItem,omitempty"` - CreateDate timestamp.Timestamp `json:"createDate,omitempty"` + Id json.Number `json:"id,Number,omitempty"` + Sensor sensor.Sensor `json:"sensor,omitempty"` + SensorItem sensorItem.SensorItem `json:"sensorItem,omitempty"` + CreateDate timestamp.Timestamp `json:"createDate,omitempty"` } type SensorItemMappingService struct { - } -func NewSensorItemMappingService() (*SensorItemMappingService) { +func NewSensorItemMappingService() *SensorItemMappingService { return &SensorItemMappingService{} } @@ -32,9 +31,7 @@ func (sims *SensorItemMappingService) Create(sim *SensorItemMapping) (string, er return out, nil } - -func (ss *SensorItemMappingService)List(s *sensor.Sensor) (string, error) { - +func (ss *SensorItemMappingService) List(s *sensor.Sensor) (string, error) { out, err := utils.InvokeDBByModel("sensorItemMapping", "findAllBySensorId", s, "com.loafle.overflow.sensor.model.Sensor") @@ -42,7 +39,6 @@ func (ss *SensorItemMappingService)List(s *sensor.Sensor) (string, error) { return "", err } + return out, nil - return out, nil; - -} \ No newline at end of file +}