overflow_proxy_service/proxy/crawler/crawler_service.go
snoop 2c00d2bc1e added
crawler 's'
2017-06-08 17:04:41 +09:00

56 lines
881 B
Go

package crawler
import (
"encoding/json"
"git.loafle.net/overflow/commons_go/model/timestamp"
"git.loafle.net/overflow/overflow_proxy_service/proxy"
)
type CrawlerService struct {
}
func NewCrawlerService() *CrawlerService {
return &CrawlerService{}
}
type Crawler struct {
Id json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CrawlerType string `json:"types,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
func (c *CrawlerService)List() string {
out := proxy.InvokeDB("crawler", "list", nil)
return out
}
func (c *CrawlerService)Create(ct * Crawler) string {
bytes, err := json.Marshal(ct)
if err != nil {
return ""
}
m := make(map[string]string)
m[""] = string(bytes)
out := proxy.InvokeDB("crawler", "create", m)
return out;
}