metadata: allow to exclude some keys in Copy func #321

Merged
vtolstov merged 2 commits from metadata-copy-exclude into v3 2024-03-09 23:50:42 +03:00
Showing only changes of commit 97d26a6ec8 - Show all commits

View File

@ -98,11 +98,12 @@ func (md Metadata) Del(keys ...string) {
}
// Copy makes a copy of the metadata
func Copy(md Metadata) Metadata {
func Copy(md Metadata, exclude ...string) Metadata {
nmd := New(len(md))
for key, val := range md {
nmd.Set(key, val)
}
nmd.Del(exclude...)
return nmd
}