Break out structs and errors into separate files in storage package

This commit is contained in:
2016-12-04 23:22:23 +00:00
parent e1debd299f
commit fa6b93d8bc
3 changed files with 13 additions and 11 deletions

6
storage/errors.go Normal file
View File

@@ -0,0 +1,6 @@
package storage
import "errors"
// ErrNotFound is the default error message when data is not found.
var ErrNotFound = errors.New("not found")

7
storage/record.go Normal file
View File

@@ -0,0 +1,7 @@
package storage
// Record provides a standard way to refer to a shortened URL.
type Record struct {
UID []byte
URL []byte
}

View File

@@ -1,10 +1,5 @@
package storage
import "errors"
// ErrNotFound is the default error message when data is not found.
var ErrNotFound = errors.New("not found")
// Store defines a standard interface for storage
type Store interface {
Close() error
@@ -15,9 +10,3 @@ type Store interface {
DeleteByURL(URL []byte) (*Record, error)
NextSequence() (int, error)
}
// Record provides a standard way to refer to a shortened URL.
type Record struct {
UID []byte
URL []byte
}