rpc/rpc.go
2022-06-29 15:26:58 +08:00

40 lines
668 B
Go

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