48 lines
937 B
Go
48 lines
937 B
Go
package gateway
|
|
|
|
import (
|
|
"golang.org/x/net/context"
|
|
pb "loafle.com/overflow/overflow_api_service/grpc"
|
|
"loafle.com/overflow/overflow_proxy_service/proxy"
|
|
"github.com/golang/glog"
|
|
"reflect"
|
|
"log"
|
|
)
|
|
|
|
var g_services map[string]interface{}
|
|
|
|
func AddServices(name string, s interface{}) {
|
|
if g_services == nil {
|
|
g_services = make(map[string]interface{},0)
|
|
}
|
|
|
|
g_services[name] = s
|
|
}
|
|
|
|
func InitServices() {
|
|
g_services = make(map[string]interface{},0)
|
|
|
|
// proxy services save
|
|
AddServices("Member", proxy.NewMember())
|
|
}
|
|
type ServiceImpl struct {
|
|
|
|
}
|
|
|
|
func (s *ServiceImpl) ExecServices(c context.Context, in *pb.ServiceInput) (*pb.ServiceOutput, error) {
|
|
// Todo Check Service Name
|
|
serviceName, ok := g_services[in.ServiceName]
|
|
|
|
log.Println(serviceName)
|
|
if !ok {
|
|
glog.Error("Not Exist Service Name")
|
|
}
|
|
|
|
// Todo Param Unmarshal
|
|
|
|
// Todo Getting a structure by service name
|
|
|
|
// Todo Call Service Method
|
|
|
|
return nil, nil
|
|
} |