store: refactor interface (#11)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-12-10 22:08:56 +03:00
committed by GitHub
parent a754ff7c0c
commit 6a7433ba2a
8 changed files with 73 additions and 62 deletions

View File

@@ -24,14 +24,14 @@ func (s *Scope) Options() store.Options {
return o
}
func (s *Scope) Read(ctx context.Context, key string, opts ...store.ReadOption) ([]*store.Record, error) {
func (s *Scope) Read(ctx context.Context, key string, val interface{}, opts ...store.ReadOption) error {
key = fmt.Sprintf("%v/%v", s.prefix, key)
return s.Store.Read(ctx, key, opts...)
return s.Store.Read(ctx, key, val, opts...)
}
func (s *Scope) Write(ctx context.Context, r *store.Record, opts ...store.WriteOption) error {
r.Key = fmt.Sprintf("%v/%v", s.prefix, r.Key)
return s.Store.Write(ctx, r, opts...)
func (s *Scope) Write(ctx context.Context, key string, val interface{}, opts ...store.WriteOption) error {
key = fmt.Sprintf("%v/%v", s.prefix, key)
return s.Store.Write(ctx, key, val, opts...)
}
func (s *Scope) Delete(ctx context.Context, key string, opts ...store.DeleteOption) error {