return error
This commit is contained in:
snoop
2017-06-08 20:53:04 +09:00
parent eab37e4281
commit 37a2128b45
11 changed files with 226 additions and 122 deletions

View File

@@ -52,7 +52,11 @@ func(as *NoAuthAgentService)SaveNoAuthAgent(na *NoAuthAgent) (string, error) {
memMap := make(map[string]string)
memMap["com.loafle.overflow.noauthagent.model.NoAuthAgent"] = string(bytes);
out := proxy.InvokeDB("noauthAgent", "create", memMap);
out, err := proxy.InvokeDB("noauthAgent", "create", memMap);
if err != nil {
return "", err
}
return out, nil;
}
@@ -71,7 +75,11 @@ func(as *NoAuthAgentService)CheckAuth(tempKey string) (string,error) {
memMap["com.loafle.overflow.noauthagent.model.NoAuthAgent"] = string(bytes);
out := proxy.InvokeDB("noauthAgent", "findByTempKey", memMap);
out, err := proxy.InvokeDB("noauthAgent", "findByTempKey", memMap);
if err != nil {
return "", err
}
nn := NoAuthAgent{}
err = json.Unmarshal([]byte(out), &nn)
@@ -98,16 +106,17 @@ func(as *NoAuthAgentService)GetNoAuthList(excludeStatus string) (string,error) {
memMap["com.loafle.overflow.noauthagent.model.NoAuthAgent"] = string(bytes);
out := proxy.InvokeDB("noauthAgent", "findAllByNoAuth", memMap);
out, err := proxy.InvokeDB("noauthAgent", "findAllByNoAuth", memMap);
if err != nil {
return "", err
}
return out,nil;
}
func (as *NoAuthAgentService) GetModel() (interface{}) {
return NewNoAuthAgent("", 0, "")
}
func (as *NoAuthAgentService)RequestAuth(noauthAgt NoAuthAgent, memberId, desc string) (string, error) {
paramMap := make(map[string]string)
@@ -118,7 +127,12 @@ func (as *NoAuthAgentService)RequestAuth(noauthAgt NoAuthAgent, memberId, desc s
return "", err;
}
paramMap["com.loafle.overflow.noauthagent.model.NoAuthAgent"] = string(bytes)
out := proxy.InvokeDB("noauthAgent", "update", paramMap)
out, err := proxy.InvokeDB("noauthAgent", "update", paramMap)
if err != nil {
return "", err
}
if len(out) == 0 {
return "", errors.New("Cannot update Agent. ")
}
@@ -136,7 +150,11 @@ func (as *NoAuthAgentService)RequestAuth(noauthAgt NoAuthAgent, memberId, desc s
func (as *NoAuthAgentService)ReadNoAuthAgent(id string) (string, error){
mm := make(map[string]string)
mm["id"] = id
out := proxy.InvokeDB("noauthAgent", "find", mm)
out, err := proxy.InvokeDB("noauthAgent", "find", mm)
if err != nil {
return "", err
}
return out, nil
}