sensor etc added

This commit is contained in:
geek
2017-06-09 16:27:44 +09:00
parent 0651a472bb
commit aefe450b95
9 changed files with 185 additions and 1 deletions

46
proxy/sensor/sensor.go Normal file
View File

@@ -0,0 +1,46 @@
package sensor
import (
"encoding/json"
"git.loafle.net/overflow/commons_go/model/timestamp"
"git.loafle.net/overflow/overflow_proxy_service/proxy/target"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
)
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"`
}
type SensorService struct {
}
func NewSensorService() *SensorService {
return &SensorService{}
}
func (ss *SensorService) Create(s *Sensor) (string, error) {
out, err := utils.InvokeDB("sensor", "create", s)
if err != nil {
return "", err
}
return out, nil
}
func (ss *SensorService)List(t *target.Target) (string, error) {
out, err := utils.InvokeDBByModel("sensor", "findAllByTargetId", t, "com.loafle.overflow.target.model.Target")
if err != nil {
return "", err
}
return out, nil;
}

View File

@@ -0,0 +1 @@
package sensor