add Delete method
This commit is contained in:
parent
784d586f48
commit
2e84afa87f
@ -18,10 +18,15 @@ func (m Store[Key, Value]) Set(key Key, value Value) {
|
|||||||
m[key] = value
|
m[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m Store[Key, Value]) Delete(key Key) {
|
||||||
|
delete(m, key)
|
||||||
|
}
|
||||||
|
|
||||||
type Mapper interface {
|
type Mapper interface {
|
||||||
Get(key string) (any, bool)
|
Get(key string) (any, bool)
|
||||||
Has(key string) (bool)
|
Has(key string) (bool)
|
||||||
Set(key string, value any)
|
Set(key string, value any)
|
||||||
|
Delete(key string)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Getter[Key comparable, Value comparable] interface {
|
type Getter[Key comparable, Value comparable] interface {
|
||||||
@ -33,6 +38,7 @@ type Map[Key comparable, Value comparable] interface {
|
|||||||
Get(key Key) (Value, bool)
|
Get(key Key) (Value, bool)
|
||||||
Has(key Key) (bool)
|
Has(key Key) (bool)
|
||||||
Set(key Key, value Value)
|
Set(key Key, value Value)
|
||||||
|
Delete(key Key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func New[Key comparable, Value comparable]() Store[Key, Value] {
|
func New[Key comparable, Value comparable]() Store[Key, Value] {
|
||||||
|
Loading…
Reference in New Issue
Block a user