metadata: add exclude to Copy func
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
ed7972a1fa
commit
97d26a6ec8
@ -98,11 +98,12 @@ func (md Metadata) Del(keys ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy makes a copy of the metadata
|
// Copy makes a copy of the metadata
|
||||||
func Copy(md Metadata) Metadata {
|
func Copy(md Metadata, exclude ...string) Metadata {
|
||||||
nmd := New(len(md))
|
nmd := New(len(md))
|
||||||
for key, val := range md {
|
for key, val := range md {
|
||||||
nmd.Set(key, val)
|
nmd.Set(key, val)
|
||||||
}
|
}
|
||||||
|
nmd.Del(exclude...)
|
||||||
return nmd
|
return nmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user