rpcmeta

package
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package rpcmeta 定义描述单个 RPC 方法的元信息结构。

它在代码生成与服务注册阶段用于携带方法名、所属服务名、 自定义标签以及请求/响应的 proto 消息原型。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(meta *RpcMeta) error

Register 注册一个 RPC 方法的元信息。meta 不可为空,Name/Method 不可为空, 且 Name 与 Method 均不可重复注册,否则触发 panic。

Types

type RpcMeta

type RpcMeta struct {
	// Method 是方法名。
	Method string
	// Name 是所属服务名。
	Name string
	// Tags 是附加在该方法上的自定义键值标签。
	Tags map[string]string
	// Input 是请求消息的 proto 原型。
	Input proto.Message
	// Output 是响应消息的 proto 原型。
	Output proto.Message
}

RpcMeta 描述一个 RPC 方法的元信息。

func Get

func Get(nameOrMethod string) *RpcMeta

Get 按服务名或方法名返回已注册的 RpcMeta,不存在时返回 nil。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL