diff --git a/proxy/crawler/crawler_service.go b/proxy/crawler/crawler_service.go index bb30378..fb1ba3b 100644 --- a/proxy/crawler/crawler_service.go +++ b/proxy/crawler/crawler_service.go @@ -41,7 +41,7 @@ func (c *CrawlerService)Create(ct * Crawler) string { - out, err := utils.InvokeDB("crawler", "create", ct, "") + out, err := utils.InvokeDB("crawler", "create", ct) if err != nil { return "" diff --git a/proxy/crawlerInputItem/crawlerinputitem_service.go b/proxy/crawlerInputItem/crawlerinputitem_service.go index 26baf5c..9f1eb13 100644 --- a/proxy/crawlerInputItem/crawlerinputitem_service.go +++ b/proxy/crawlerInputItem/crawlerinputitem_service.go @@ -25,7 +25,7 @@ func NewCrawlerInputItemService() *CrawlerInputItemSerivce { func (c *CrawlerInputItemSerivce)Create(cii * CrawlerInputItem) string { - out, err := utils.InvokeDB("crawlerInputItem", "create", cii, "") + out, err := utils.InvokeDB("crawlerInputItem", "create", cii) if err != nil { return "" diff --git a/proxy/crawlerinputitemmapping/crawlerinputitemmapping_service.go b/proxy/crawlerinputitemmapping/crawlerinputitemmapping_service.go index 7a3da30..4e95dd3 100644 --- a/proxy/crawlerinputitemmapping/crawlerinputitemmapping_service.go +++ b/proxy/crawlerinputitemmapping/crawlerinputitemmapping_service.go @@ -28,7 +28,7 @@ func NewCrawlerInputItemMappingService() *CrawlerInputItemMappingService { func (c *CrawlerInputItemMappingService)Create(ciim *CrawlerInputItemMapping) string { - out, err := utils.InvokeDB("crawlerInputItemMapping", "create", ciim, "") + out, err := utils.InvokeDB("crawlerInputItemMapping", "create", ciim) if err != nil { return "" @@ -37,4 +37,8 @@ func (c *CrawlerInputItemMappingService)Create(ciim *CrawlerInputItemMapping) st return out; +} + +func (c *CrawlerInputItemMappingService)Create(ciim *CrawlerInputItemMapping) string { + } \ No newline at end of file diff --git a/proxy/target/target_service.go b/proxy/target/target_service.go index 3318426..4f0e334 100644 --- a/proxy/target/target_service.go +++ b/proxy/target/target_service.go @@ -69,7 +69,7 @@ func (t *TargetService)Create(tm *Target) string { // //out := proxy.InvokeDB("target", "create", m) - out, err := utils.InvokeDB("target", "create", tm, "com.loafle.overflow.target.model.Target") + out, err := utils.InvokeDB("target", "create", tm) if err != nil { return "" diff --git a/proxy/utils/DBInvokeUtil.go b/proxy/utils/DBInvokeUtil.go index d19d71d..cd13f52 100644 --- a/proxy/utils/DBInvokeUtil.go +++ b/proxy/utils/DBInvokeUtil.go @@ -5,7 +5,7 @@ import ( "git.loafle.net/overflow/overflow_proxy_service/proxy" ) -func InvokeDB( db string, method string, obj interface{}, model string) (string, error) { +func InvokeDB( db string, method string, obj interface{}) (string, error) { bytes, err := json.Marshal(obj) if err != nil { @@ -14,7 +14,7 @@ func InvokeDB( db string, method string, obj interface{}, model string) (string, m := make(map[string]string) - m[model] = string(bytes) + m[GenerateModelStr(db)] = string(bytes) out := proxy.InvokeDB(db, method, m) diff --git a/proxy/utils/string.go b/proxy/utils/string.go new file mode 100644 index 0000000..883fc9d --- /dev/null +++ b/proxy/utils/string.go @@ -0,0 +1,21 @@ +package utils + +import "strings" + +const ( + defaultPackage = "com.loafle.overflow." + modelPackageName = ".model." +) + +func GenerateModelStr(model string) string { + + tm := strings.Title(model) + + + res := defaultPackage + res += model + res += modelPackageName + res += tm + + return res +} \ No newline at end of file diff --git a/proxy/utils/string_test.go b/proxy/utils/string_test.go new file mode 100644 index 0000000..6aebbf8 --- /dev/null +++ b/proxy/utils/string_test.go @@ -0,0 +1,24 @@ +package utils + +import ( + "testing" + "strings" +) + +func TestStringUpper(t *testing.T) { + + res := "crawlerInputItem" + + aa := strings.Title(res) + + + t.Log(aa) + + +} + +func TestGM(t *testing.T) { + + t.Log(GenerateModelStr("target")) + +} \ No newline at end of file