kvs/kv/MapKvs.go

29 lines
464 B
Go
Raw Normal View History

2023-04-18 14:24:20 +08:00
package kv
import (
"github.com/tursom/GoCollections/exceptions"
"github.com/tursom/GoCollections/lang"
)
type (
mapKvs struct {
lang.BaseObject
m map[string][]byte
}
)
func MapKvs() Store[string, []byte] {
return &mapKvs{
m: make(map[string][]byte),
}
}
func (m *mapKvs) Put(key string, value []byte) exceptions.Exception {
m.m[key] = value
return nil
}
func (m *mapKvs) Get(key string) ([]byte, exceptions.Exception) {
return m.m[key], nil
}