add Delete method
Some checks are pending
Lint / golangci-lint (push) Waiting to run
Declarative Tests / test (push) Waiting to run

This commit is contained in:
Matthew Rich 2024-10-09 22:28:00 +00:00
parent 784d586f48
commit 2e84afa87f

View File

@ -18,10 +18,15 @@ func (m Store[Key, Value]) Set(key Key, value Value) {
m[key] = value
}
func (m Store[Key, Value]) Delete(key Key) {
delete(m, key)
}
type Mapper interface {
Get(key string) (any, bool)
Has(key string) (bool)
Set(key string, value any)
Delete(key string)
}
type Getter[Key comparable, Value comparable] interface {
@ -33,6 +38,7 @@ type Map[Key comparable, Value comparable] interface {
Get(key Key) (Value, bool)
Has(key Key) (bool)
Set(key Key, value Value)
Delete(key Key)
}
func New[Key comparable, Value comparable]() Store[Key, Value] {