1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00
wakapi/services/key_value.go

32 lines
763 B
Go
Raw Normal View History

package services
import (
"github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"github.com/muety/wakapi/repositories"
)
type KeyValueService struct {
config *config.Config
repository *repositories.KeyValueRepository
}
func NewKeyValueService(keyValueRepo *repositories.KeyValueRepository) *KeyValueService {
return &KeyValueService{
config: config.Get(),
repository: keyValueRepo,
}
}
func (srv *KeyValueService) GetString(key string) (*models.KeyStringValue, error) {
return srv.repository.GetString(key)
}
func (srv *KeyValueService) PutString(kv *models.KeyStringValue) error {
return srv.repository.PutString(kv)
}
func (srv *KeyValueService) DeleteString(key string) error {
return srv.repository.DeleteString(key)
}