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
|
return val, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (md Metadata) Del(key string) {
|
func (md Metadata) Delete(key string) {
|
||||||
// delete key as-is
|
// delete key as-is
|
||||||
delete(md, key)
|
delete(md, key)
|
||||||
// delete also Title key
|
// delete also Title key
|
||||||
@ -41,8 +41,8 @@ func Copy(md Metadata) Metadata {
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// Del key from metadata
|
// Delete key from metadata
|
||||||
func Del(ctx context.Context, k string) context.Context {
|
func Delete(ctx context.Context, k string) context.Context {
|
||||||
return Set(ctx, k, "")
|
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{
|
md := Metadata{
|
||||||
"Foo": "bar",
|
"Foo": "bar",
|
||||||
"Baz": "empty",
|
"Baz": "empty",
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := NewContext(context.TODO(), md)
|
ctx := NewContext(context.TODO(), md)
|
||||||
ctx = Set(ctx, "Baz", "")
|
ctx = Delete(ctx, "Baz")
|
||||||
|
|
||||||
emd, ok := FromContext(ctx)
|
emd, ok := FromContext(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user