first overflow service commit

This commit is contained in:
snoop
2017-06-22 12:07:45 +09:00
commit 19427d74a7
42 changed files with 2595 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
package sensorItem
import (
"encoding/json"
"git.loafle.net/overflow/commons_go/model/timestamp"
"git.loafle.net/overflow/overflow_proxy_service/proxy/crawler"
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensorItemCategory"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
)
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"`
}
type SensorItemService struct {
}
func NewSensorItemService() *SensorItemService {
return &SensorItemService{}
}
func (sis *SensorItemService) Create(si *SensorItem) (string, error) {
out, err := utils.InvokeDBByModel("sensorItem", "create", si, "com.loafle.overflow.sensor.model.SensorItem")
if err != nil {
return "", err
}
return out, nil
}
func (ss *SensorItemService) List(cr *crawler.Crawler) (string, error) {
out, err := utils.InvokeDBByModel("sensorItem", "findAllByCrawlerId", cr, "com.loafle.overflow.crawler.model.Crawler")
if err != nil {
return "", err
}
return out, nil
}

View File

@@ -0,0 +1,18 @@
package sensorItem
import (
"encoding/json"
"git.loafle.net/overflow/overflow_proxy_service/proxy/crawler"
"testing"
)
func TestSensorItemService_List(t *testing.T) {
cr := &crawler.Crawler{}
cr.Id = json.Number("1")
sis := NewSensorItemService()
res, _ := sis.List(cr)
t.Log(res)
}