Documentation ¶
Index ¶
- Variables
- func APP() *app
- func AddHandler(handles ...interface{})
- func AddMetadata(meta map[string]string)
- func AddPub(names ...string)
- func AddSub(name string, h interface{}, queue ...bool) error
- func AddSubQueue(name string, h interface{}) error
- func CallCtx(ctx context.Context, srvName string, method string, in interface{}, ...) error
- func CallNode(ctx context.Context, srvName string, method string, in interface{}, ...) error
- func Cancel(name string, id ...string) error
- func CheckServiceNode(srvName string, nodeId string) bool
- func Client() client.Client
- func Close()
- func ExcludeServiceNodeIds(srvName string, exclude ...string) []string
- func FilterNodeId(srvName, id string) selector.Filter
- func FilterSelector(filter selector.Filter) client.CallOption
- func FilterServiceNode(srvName, nodeId string) client.CallOption
- func FilterServiceNodeIds(srvName string, filter ...string) []string
- func GetPub(name string) micro.Publisher
- func GetRandomNodeId(srvName string) (string, error)
- func GetServiceNodeIds(srvName string) []string
- func GetServices(name string) []*registry.Service
- func Id() string
- func Init(opts ...micro.Option)
- func Name() string
- func NameId() string
- func New(name string, version string, extra ...[]cli.Flag)
- func Pub(name string, msg interface{}, opts ...client.PublishOption) error
- func PubCtx(ctx context.Context, name string, msg interface{}, ...) error
- func Registry() registry.Registry
- func Run() error
- func Server() server.Server
- func Srv() micro.Service
- func Version() string
- type ServiceNode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Opts = new(struct { Dev bool // 是否开发模式 PsAddr string // gops分析 Lang string // 设置语言环境 }) )
Functions ¶
func AddSubQueue ¶
func CallCtx ¶
func CallCtx(ctx context.Context, srvName string, method string, in interface{}, out interface{}, opts ...client.CallOption) error
Call 通过名称调用RPC
@name 服务名称 @method rpc方法名称. 即 serviceName.rpcName @in 请求参数 @out 返回数据 @nodeId 指定节点ID
func CallNode ¶
func CallNode(ctx context.Context, srvName string, method string, in interface{}, out interface{}, nodeId ...string) error
CallCtx 通过名称调用RPC
@name 服务名称 @method rpc方法名称. 即 serviceName.rpcName @in 请求参数 @out 返回数据 @nodeId 指定节点ID
func CheckServiceNode ¶
CheckServiceNode 检查服务节点是否存在
func ExcludeServiceNodeIds ¶
ExcludeServiceNodeIds 获取指定服务所有节点的ID列表
func FilterServiceNodeIds ¶
FilterServiceNodeIds 获取指定服务所有节点的ID列表
func GetServiceNodeIds ¶
GetServiceNodeIds 获取指定服务所有节点的ID列表
Types ¶
type ServiceNode ¶
type ServiceNode struct { UUID string `json:"uuid"` Id string `json:"id"` Version string `json:"version"` Address string `json:"address"` Metadata map[string]string `json:"metadata"` }
服务节点
func GetServiceNode ¶
func GetServiceNode(srvName string, nodeId string) *ServiceNode
GetServiceNode 获取指定服务指定节点
func GetServiceNodes ¶
func GetServiceNodes(srvName string) []*ServiceNode
GetServiceNodes 获取指定服务所有节点
func GetServiceNodesVersion ¶
func GetServiceNodesVersion(srvName string, version string) []*ServiceNode
GetServiceNodesVersion 获取指定版本服务节点
Click to show internal directories.
Click to hide internal directories.