rpc/rpc.go

40 lines
668 B
Go
Raw Normal View History

2022-06-29 15:25:35 +08:00
// Package rpc ...
//
// Description : rpc ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2022-06-29 15:21
package rpc
import (
"sync"
"go.uber.org/zap"
)
2022-06-29 15:26:58 +08:00
var (
// Request 请求实例
Request *request
)
2022-06-29 15:25:35 +08:00
// InitRPC 初始化RPC服务
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:23 2022/6/29
2022-06-29 15:26:58 +08:00
func InitRPC(serviceTable map[string]Service, loggerInstance *zap.Logger) error {
Request = &request{
2022-06-29 15:25:35 +08:00
logger: loggerInstance,
serviceTable: serviceTable,
lock: &sync.RWMutex{},
}
2022-06-29 15:26:58 +08:00
return nil
2022-06-29 15:25:35 +08:00
}
type request struct {
logger *zap.Logger
serviceTable map[string]Service
lock *sync.RWMutex
}