mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
26 lines
630 B
Go
26 lines
630 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
func NewOffice(c discoveryregistry.SvcDiscoveryRegistry) *Office {
|
|
conn, err := c.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImOfficeName)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return &Office{conn: conn}
|
|
}
|
|
|
|
type Office struct {
|
|
conn *grpc.ClientConn
|
|
}
|
|
|
|
func (o *Office) client(ctx context.Context) (office.OfficeClient, error) {
|
|
return office.NewOfficeClient(o.conn), nil
|
|
}
|