add Delete
This commit is contained in:
25
kv/PrefixCodec.go
Normal file
25
kv/PrefixCodec.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package kv
|
||||
|
||||
import (
|
||||
"github.com/tursom/GoCollections/exceptions"
|
||||
"github.com/tursom/GoCollections/lang"
|
||||
)
|
||||
|
||||
type (
|
||||
prefixCodec struct {
|
||||
lang.BaseObject
|
||||
prefix string
|
||||
}
|
||||
)
|
||||
|
||||
func PrefixCodec(prefix string) Codec[string, string] {
|
||||
return &prefixCodec{prefix: prefix}
|
||||
}
|
||||
|
||||
func (p *prefixCodec) Encode(v2 string) string {
|
||||
return p.prefix + v2
|
||||
}
|
||||
|
||||
func (p *prefixCodec) Decode(v1 string) string {
|
||||
panic(exceptions.NewIllegalAccessException("unsupported method", nil))
|
||||
}
|
||||
Reference in New Issue
Block a user