Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/metadata: 提供Range方法 #64

Closed
Terry-Mao opened this issue Apr 30, 2019 · 0 comments · Fixed by #77
Closed

net/metadata: 提供Range方法 #64

Terry-Mao opened this issue Apr 30, 2019 · 0 comments · Fixed by #77
Labels
enhancement New feature or request

Comments

@Terry-Mao
Copy link
Member

现在枚举metadata的方式:

if cmd, ok := metadata.FromContext(c); ok {
    for key, value := range cmd {
        if !metadata.IsOutgoingKey(key) {
        }
    }

比较麻烦,提供一个简易的方式:

func Range(rn func(key string, value interface{}), ...fn func (key string) bool)

metadata.Range(func(key string, value interface{}) {
   fmt.Println("%s: %v", key, value)
}, metadata.IsOutgoingkey)
@Terry-Mao Terry-Mao added the enhancement New feature or request label Apr 30, 2019
@nottoask nottoask mentioned this issue May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant