feat 初始化

This commit is contained in:
2026-10-29 11:28:42 +08:00
parent 09c1df8a22
commit 6ffe49ff5b
23 changed files with 130 additions and 577 deletions

View File

@@ -0,0 +1,23 @@
package grpcclient
import (
"git.hlsq.asia/alex/proto/proto/rs/rspb"
"git.hlsq.asia/alex/service-common/discover"
"git.hlsq.asia/alex/service-common/discover/common"
"git.hlsq.asia/alex/service-common/net/grpc/resolver"
"google.golang.org/grpc"
)
func NoticeNewClient(sid ...int64) (rspb.NoticeClient, error) {
var c *grpc.ClientConn
var err error
if len(sid) == 0 {
c, err = resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameNotice)
} else {
c, err = discover.FindServer(common.KeyDiscoverNotice, sid...)
}
if err != nil {
return nil, err
}
return rspb.NewNoticeClient(c), nil
}