metadata: allow to exclude some keys in Copy func #321
| @@ -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 | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user