当前位置:网站首页>Go controls the metadata of grpc

Go controls the metadata of grpc

2022-01-15 02:24:03 JasonHome

1、 brief introduction

gRPC Let's implement remote calls just like local calls , For every time rpc call , There may be some useful data , And these data can be passed through metadata To pass on .metadata In order to key-value Storage of data in the form of , among key yes string type , and value yes []string, That is, a string slice type .metadata bring client and server It can provide the other party with some information about this call , Just once http Requested RequestHeader and ResponseHeaader equally .http in header The declaration cycle of is once http request , that metadata The life cycle of is once rpc call .

2、 Official source code and documentation

3、 Use

3.1 newly build metadata

MD The type is actually map,key yes string,value yes string The section of

type MD map

版权声明
本文为[JasonHome]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/12/202112122242394856.html

随机推荐