message driver storage

This commit is contained in:
bel
2024-04-11 22:23:17 -06:00
parent b39b5a66e7
commit def095e0e8
7 changed files with 166 additions and 0 deletions

22
storage.go Normal file
View File

@@ -0,0 +1,22 @@
package main
import "context"
type Storage struct {
driver Driver
}
type Driver interface {
Close() error
ForEach(context.Context, func(string, []byte) error) error
Get(context.Context, string) ([]byte, error)
Set(context.Context, string, []byte) error
}
func NewTestStorage() Storage {
return Storage{driver: NewTestDB()}
}
func NewStorage(driver Driver) Storage {
return Storage{driver: driver}
}