Move data to top level

This commit is contained in:
Asim Aslam
2019-06-11 17:20:52 +01:00
parent 6d06ee8078
commit 8e4e710e15
8 changed files with 39 additions and 63 deletions

34
data/data.go Normal file
View File

@@ -0,0 +1,34 @@
// Package data is an interface for key-value storage.
package data
import (
"errors"
"time"
"github.com/micro/go-micro/options"
)
var (
ErrNotFound = errors.New("not found")
)
// Data is a data storage interface
type Data interface {
// embed options
options.Options
// Dump the known records
Dump() ([]*Record, error)
// Read a record with key
Read(key string) (*Record, error)
// Write a record
Write(r *Record) error
// Delete a record with key
Delete(key string) error
}
// Record represents a data record
type Record struct {
Key string
Value []byte
Expiration time.Duration
}