feat: updated pkg implementations
This commit is contained in:
parent
86f37555b2
commit
8b161135ff
10 changed files with 579 additions and 140 deletions
|
|
@ -6,7 +6,16 @@ type MemoryStorage struct {
|
|||
Data map[string]any
|
||||
}
|
||||
|
||||
func (ms *MemoryStorage) Read(k string) (any, error) {
|
||||
func (ms *MemoryStorage) Init() error {
|
||||
ms.Data = map[string]any{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ms *MemoryStorage) Cleanup() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ms *MemoryStorage) Get(k string) (any, error) {
|
||||
v, ok := ms.Data[k]
|
||||
if ok {
|
||||
return v, nil
|
||||
|
|
@ -14,7 +23,11 @@ func (ms *MemoryStorage) Read(k string) (any, error) {
|
|||
return nil, fmt.Errorf("value does not exist")
|
||||
}
|
||||
|
||||
func (ms *MemoryStorage) Write(k string, v any) error {
|
||||
func (ms *MemoryStorage) Set(k string, v any) error {
|
||||
ms.Data[k] = v
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ms *MemoryStorage) GetData() any {
|
||||
return ms.Data
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue