From fa6b93d8bccab1b7070ddc2c24231f43b77583d0 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 4 Dec 2016 23:22:23 +0000 Subject: [PATCH] Break out structs and errors into separate files in storage package --- storage/errors.go | 6 ++++++ storage/record.go | 7 +++++++ storage/store.go | 11 ----------- 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 storage/errors.go create mode 100644 storage/record.go diff --git a/storage/errors.go b/storage/errors.go new file mode 100644 index 0000000..5c9760c --- /dev/null +++ b/storage/errors.go @@ -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") diff --git a/storage/record.go b/storage/record.go new file mode 100644 index 0000000..1de9d34 --- /dev/null +++ b/storage/record.go @@ -0,0 +1,7 @@ +package storage + +// Record provides a standard way to refer to a shortened URL. +type Record struct { + UID []byte + URL []byte +} diff --git a/storage/store.go b/storage/store.go index 6514e1b..04ab6f0 100644 --- a/storage/store.go +++ b/storage/store.go @@ -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 -}