From ee8b369a19fc6ee11ebf5e27ab255c92a97684ba Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Tue, 29 Dec 2020 16:50:18 +0000 Subject: [PATCH] add initialisers --- store/{default.go => memory.go} | 4 ++-- store/noop.go | 4 ++++ store/store.go | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) rename store/{default.go => memory.go} (98%) diff --git a/store/default.go b/store/memory.go similarity index 98% rename from store/default.go rename to store/memory.go index f983d917..cda250cb 100644 --- a/store/default.go +++ b/store/memory.go @@ -10,8 +10,8 @@ import ( "github.com/pkg/errors" ) -// NewStore returns a memory store -func NewStore(opts ...Option) Store { +// NewMemoryStore returns a memory store +func NewMemoryStore(opts ...Option) Store { s := &memoryStore{ options: Options{ Database: "micro", diff --git a/store/noop.go b/store/noop.go index 25d4850a..4bc3c578 100644 --- a/store/noop.go +++ b/store/noop.go @@ -33,3 +33,7 @@ func (n *noopStore) List(opts ...ListOption) ([]string, error) { func (n *noopStore) Close() error { return nil } + +func NewNoopStore(opts ...Option) Store { + return new(noopStore) +} diff --git a/store/store.go b/store/store.go index 3c475d19..d46b7b7a 100644 --- a/store/store.go +++ b/store/store.go @@ -45,3 +45,7 @@ type Record struct { // Time to expire a record: TODO: change to timestamp Expiry time.Duration `json:"expiry,omitempty"` } + +func NewStore(opts ...Option) Store { + return NewMemoryStore(opts...) +}