overflow_proxy_service/proxy/member_service.go

83 lines
1.5 KiB
Go
Raw Normal View History

2017-05-23 10:12:57 +00:00
package proxy
import (
"log"
"encoding/json"
)
2017-05-23 10:12:57 +00:00
type MemberService struct {
Email string `json:"email"`
PwSalt string `json:"pwSalt"`
Digest string `json:"digest"`
Name string `json:"name"`
Company string `json:"company"`
Phone string `json:"phone"`
2017-05-23 10:12:57 +00:00
}
var TARGET_DAO = "member"
2017-05-23 10:12:57 +00:00
func NewMember() *MemberService {
m := MemberService{}
return &m
}
func (m *MemberService) getMemberMap() (map[string]string) {
memMap := make(map[string]string)
str, err := json.Marshal(m)
if err != nil {
log.Fatal("Json Marshal Error: ", err)
}
memMap["com.loafle.overflow.member.model.Member"] = string(str)
return memMap
}
2017-05-24 06:34:41 +00:00
func (m *MemberService) Regist() (string){
2017-05-25 10:08:03 +00:00
log.Println("Call Regist", m.Email, m.PwSalt)
2017-05-23 10:12:57 +00:00
// Todo Call DB Gateway
2017-05-25 10:08:03 +00:00
m.Digest = "dddddddd"
memMap := m.getMemberMap()
re := invokeDB(TARGET_DAO, "create", memMap)
return re
2017-05-23 10:12:57 +00:00
}
2017-05-24 06:34:41 +00:00
func (m *MemberService) Read() (string){
log.Println("Call Read", m.Email)
2017-05-23 10:12:57 +00:00
// Todo Call DB Gateway
m.Digest = "read"
memMap := m.getMemberMap()
re := invokeDB(TARGET_DAO, "find", memMap)
return re
2017-05-23 10:12:57 +00:00
}
2017-05-24 06:34:41 +00:00
func (m *MemberService) Modify() (string){
2017-05-25 10:08:03 +00:00
log.Println("Call Modify", m.Email, "::", m.PwSalt)
2017-05-23 10:12:57 +00:00
// Todo Call DB Gateway
m.Digest = "read"
memMap := m.getMemberMap()
re := invokeDB(TARGET_DAO, "update", memMap)
return re
2017-05-23 10:12:57 +00:00
}
2017-05-24 06:34:41 +00:00
func (m *MemberService) Remove() (string){
log.Println("Call Remove", m.Email)
2017-05-23 10:12:57 +00:00
// Todo Call DB Gateway
m.Digest = "read"
memMap := m.getMemberMap()
re := invokeDB(TARGET_DAO, "delete", memMap)
return re
2017-05-23 10:12:57 +00:00
}