diff --git a/.gitignore b/.gitignore index 8e2ebe9..07aabdd 100644 --- a/.gitignore +++ b/.gitignore @@ -58,4 +58,5 @@ fabric.properties # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 .glide/ - +.idea/ +*.iml diff --git a/proxy/member_service.go b/proxy/member/member_service.go similarity index 86% rename from proxy/member_service.go rename to proxy/member/member_service.go index ec0a64d..908501d 100644 --- a/proxy/member_service.go +++ b/proxy/member/member_service.go @@ -1,8 +1,9 @@ -package proxy +package member import ( "encoding/json" "git.loafle.net/overflow/encryption_go" + "git.loafle.net/overflow/overflow_proxy_service/proxy" "log" ) @@ -69,7 +70,7 @@ func (m *MemberService) Regist() string { m.Digest = digest memMap := m.getMemberMap() - re := invokeDB(TARGET_DAO, "create", memMap) + re := proxy.InvokeDB(TARGET_DAO, "create", memMap) return re } @@ -77,7 +78,7 @@ func (m *MemberService) Regist() string { func (m *MemberService) ReadByEmail() string { log.Println("Call ReadByEmail", m.Email) memMap := m.getMemberMap() - re := invokeDB(TARGET_DAO, "findByEmail", memMap) + re := proxy.InvokeDB(TARGET_DAO, "findByEmail", memMap) return re } @@ -89,7 +90,7 @@ func (m *MemberService) Read() string { mm := make(map[string]string) mm["id"] = string(m.Id) log.Println("Read Member", m) - re := invokeDB(TARGET_DAO, "find", mm) + re := proxy.InvokeDB(TARGET_DAO, "find", mm) return re } @@ -100,7 +101,7 @@ func (m *MemberService) Modify() string { m.Digest = "read" memMap := m.getMemberMap() - re := invokeDB(TARGET_DAO, "update", memMap) + re := proxy.InvokeDB(TARGET_DAO, "update", memMap) return re } @@ -111,7 +112,7 @@ func (m *MemberService) Remove() string { m.Digest = "read" memMap := m.getMemberMap() - re := invokeDB(TARGET_DAO, "delete", memMap) + re := proxy.InvokeDB(TARGET_DAO, "delete", memMap) return re } diff --git a/proxy/member_service_test.go b/proxy/member/member_service_test.go similarity index 79% rename from proxy/member_service_test.go rename to proxy/member/member_service_test.go index e2244d6..872c4ac 100644 --- a/proxy/member_service_test.go +++ b/proxy/member/member_service_test.go @@ -1,8 +1,9 @@ -package proxy +package member import ( "testing" "log" + "git.loafle.net/overflow/overflow_proxy_service/proxy" ) func TestMemberService_Login(t *testing.T) { @@ -34,7 +35,7 @@ func TestMemberLogin(t *testing.T) { func TestMemberService_Read(t *testing.T) { mm := make(map[string] string) mm["id"] = "12" - rr := invokeDB(TARGET_DAO, "find", mm) + rr := proxy.InvokeDB(TARGET_DAO, "find", mm) log.Println(rr) } @@ -45,7 +46,7 @@ func TestMemberService_ReadByEmail(t *testing.T) { } mm := m.getMemberMap() - rr := invokeDB(TARGET_DAO, "findByEmail", mm) + rr := proxy.InvokeDB(TARGET_DAO, "findByEmail", mm) log.Println(rr) } @@ -56,6 +57,6 @@ func TestMemberUpdate(t *testing.T) { } mm := m.getMemberMap() - rr := invokeDB(TARGET_DAO, "update", mm) + rr := proxy.InvokeDB(TARGET_DAO, "update", mm) log.Println(rr) } \ No newline at end of file diff --git a/proxy/service.go b/proxy/service.go index d7a9a2d..15275f8 100644 --- a/proxy/service.go +++ b/proxy/service.go @@ -7,7 +7,7 @@ import ( "golang.org/x/net/context" ) -func invokeDB(targetDb, methodName string, param map[string]string) (string) { +func InvokeDB(targetDb, methodName string, param map[string]string) (string) { in := &pb.DBInput{} in.TargetDao = targetDb