From fdf31cf4c0e320eff6d3b6fa9abf07159e68fa0d Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Thu, 5 Nov 2020 09:47:33 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=20update=20signatures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- memcache/README.md | 2 ++ memcache/memcache.go | 2 +- memory/README.md | 7 +++++++ mongodb/README.md | 7 +++++++ mysql/README.md | 7 +++++++ postgres/README.md | 7 +++++++ redis/README.md | 7 +++++++ sqlite3/README.md | 7 +++++++ 8 files changed, 45 insertions(+), 1 deletion(-) diff --git a/memcache/README.md b/memcache/README.md index f9ecbe7d..19abde96 100644 --- a/memcache/README.md +++ b/memcache/README.md @@ -11,6 +11,8 @@ A Memcache storage driver using [`bradfitz/gomemcache`](https://github.com/bradf ### Signatures ```go func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") ``` ### Examples diff --git a/memcache/memcache.go b/memcache/memcache.go index cab3a5b0..526d1c85 100644 --- a/memcache/memcache.go +++ b/memcache/memcache.go @@ -62,7 +62,7 @@ func New(config ...Config) *Storage { func (s *Storage) Get(key string) ([]byte, error) { item, err := s.db.Get(key) if err == mc.ErrCacheMiss { - return nil, nil + return nil, ErrNotExist } else if err != nil { return nil, err } diff --git a/memory/README.md b/memory/README.md index f08af3ce..8494a92e 100644 --- a/memory/README.md +++ b/memory/README.md @@ -11,6 +11,13 @@ An in-memory storage driver. ### Signatures ```go func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") + +func (s *Storage) Get(key string) ([]byte, error) +func (s *Storage) Set(key string, val []byte, exp time.Duration) error +func (s *Storage) Delete(key string) error +func (s *Storage) Clear() error ``` ### Examples diff --git a/mongodb/README.md b/mongodb/README.md index d02ef744..948bd8a5 100644 --- a/mongodb/README.md +++ b/mongodb/README.md @@ -11,6 +11,13 @@ A MongoDB storage driver using [mongodb/mongo-go-driver](https://github.com/mong ### Signatures ```go func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") + +func (s *Storage) Get(key string) ([]byte, error) +func (s *Storage) Set(key string, val []byte, exp time.Duration) error +func (s *Storage) Delete(key string) error +func (s *Storage) Clear() error ``` ### Examples diff --git a/mysql/README.md b/mysql/README.md index 05d9bcb0..98c7d220 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -11,6 +11,13 @@ A MySQL storage driver using `database/sql` and [go-sql-driver/mysql](https://gi ### Signatures ```go func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") + +func (s *Storage) Get(key string) ([]byte, error) +func (s *Storage) Set(key string, val []byte, exp time.Duration) error +func (s *Storage) Delete(key string) error +func (s *Storage) Clear() error ``` ### Examples diff --git a/postgres/README.md b/postgres/README.md index 1b4c26b7..aadfd489 100644 --- a/postgres/README.md +++ b/postgres/README.md @@ -11,6 +11,13 @@ A Postgres storage driver using [lib/pq](https://github.com/lib/pq). ### Signatures ```go func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") + +func (s *Storage) Get(key string) ([]byte, error) +func (s *Storage) Set(key string, val []byte, exp time.Duration) error +func (s *Storage) Delete(key string) error +func (s *Storage) Clear() error ``` ### Examples diff --git a/redis/README.md b/redis/README.md index d9841aff..536e27b1 100644 --- a/redis/README.md +++ b/redis/README.md @@ -11,6 +11,13 @@ A Redis storage driver using [go-redis/redis](github.com/go-redis/redis). ### Signatures ```go func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") + +func (s *Storage) Get(key string) ([]byte, error) +func (s *Storage) Set(key string, val []byte, exp time.Duration) error +func (s *Storage) Delete(key string) error +func (s *Storage) Clear() error ``` ### Examples diff --git a/sqlite3/README.md b/sqlite3/README.md index c6035fd7..1a47a85c 100644 --- a/sqlite3/README.md +++ b/sqlite3/README.md @@ -11,6 +11,13 @@ A SQLite3 storage driver using [mattn/go-sqlite3](https://github.com/mattn/go-sq ### Signatures ```go func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") + +func (s *Storage) Get(key string) ([]byte, error) +func (s *Storage) Set(key string, val []byte, exp time.Duration) error +func (s *Storage) Delete(key string) error +func (s *Storage) Clear() error ``` ### Examples