24 lines
642 B
Go
24 lines
642 B
Go
package client
|
|
|
|
import (
|
|
"git.vitatech.com.cn/leo/proto.git/discovery"
|
|
"git.vitatech.com.cn/leo/proto.git/micro_layout/proto/user"
|
|
)
|
|
|
|
const ServiceName = "micro.micro_layout"
|
|
|
|
type MicroLayoutClient struct {
|
|
User user.UserClient
|
|
connection *discovery.Connection
|
|
}
|
|
|
|
func NewMicroLayoutClient(cfg discovery.Config, service string) (*MicroLayoutClient, error) {
|
|
connection, err := discovery.Dial(cfg, service)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &MicroLayoutClient{User: user.NewUserClient(connection.Conn), connection: connection}, nil
|
|
}
|
|
|
|
func (client *MicroLayoutClient) Close() error { return client.connection.Close() }
|