metadata: change method name (#1454)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
5e65a46be3
commit
3a22efbd7d
@ -25,7 +25,7 @@ func (md Metadata) Get(key string) (string, bool) {
|
||||
return val, ok
|
||||
}
|
||||
|
||||
func (md Metadata) Del(key string) {
|
||||
func (md Metadata) Delete(key string) {
|
||||
// delete key as-is
|
||||
delete(md, key)
|
||||
// delete also Title key
|
||||
@ -41,8 +41,8 @@ func Copy(md Metadata) Metadata {
|
||||
return cmd
|
||||
}
|
||||
|
||||
// Del key from metadata
|
||||
func Del(ctx context.Context, k string) context.Context {
|
||||
// Delete key from metadata
|
||||
func Delete(ctx context.Context, k string) context.Context {
|
||||
return Set(ctx, k, "")
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,14 @@ func TestMetadataSet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMetadataDel(t *testing.T) {
|
||||
func TestMetadataDelete(t *testing.T) {
|
||||
md := Metadata{
|
||||
"Foo": "bar",
|
||||
"Baz": "empty",
|
||||
}
|
||||
|
||||
ctx := NewContext(context.TODO(), md)
|
||||
ctx = Set(ctx, "Baz", "")
|
||||
ctx = Delete(ctx, "Baz")
|
||||
|
||||
emd, ok := FromContext(ctx)
|
||||
if !ok {
|
||||
|
Loading…
x
Reference in New Issue
Block a user