This commit is contained in:
admin committed 2026-11-06 16:58:42 +08:00
commit ee2718a1d0
17 files changed
+5264

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
package client
import (
"example.com/layout/proto/discovery"
"example.com/layout/proto/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() }