✏ update signatures

This commit is contained in:
Fenny
2020-11-05 09:47:33 +01:00
parent f7e5345bc3
commit fdf31cf4c0
8 changed files with 45 additions and 1 deletions

View File

@@ -11,6 +11,8 @@ A Memcache storage driver using [`bradfitz/gomemcache`](https://github.com/bradf
### Signatures ### Signatures
```go ```go
func New(config ...Config) Storage func New(config ...Config) Storage
var ErrNotExist = errors.New("key does not exist")
``` ```
### Examples ### Examples

View File

@@ -62,7 +62,7 @@ func New(config ...Config) *Storage {
func (s *Storage) Get(key string) ([]byte, error) { func (s *Storage) Get(key string) ([]byte, error) {
item, err := s.db.Get(key) item, err := s.db.Get(key)
if err == mc.ErrCacheMiss { if err == mc.ErrCacheMiss {
return nil, nil return nil, ErrNotExist
} else if err != nil { } else if err != nil {
return nil, err return nil, err
} }

View File

@@ -11,6 +11,13 @@ An in-memory storage driver.
### Signatures ### Signatures
```go ```go
func New(config ...Config) Storage 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 ### Examples

View File

@@ -11,6 +11,13 @@ A MongoDB storage driver using [mongodb/mongo-go-driver](https://github.com/mong
### Signatures ### Signatures
```go ```go
func New(config ...Config) Storage 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 ### Examples

View File

@@ -11,6 +11,13 @@ A MySQL storage driver using `database/sql` and [go-sql-driver/mysql](https://gi
### Signatures ### Signatures
```go ```go
func New(config ...Config) Storage 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 ### Examples

View File

@@ -11,6 +11,13 @@ A Postgres storage driver using [lib/pq](https://github.com/lib/pq).
### Signatures ### Signatures
```go ```go
func New(config ...Config) Storage 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 ### Examples

View File

@@ -11,6 +11,13 @@ A Redis storage driver using [go-redis/redis](github.com/go-redis/redis).
### Signatures ### Signatures
```go ```go
func New(config ...Config) Storage 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 ### Examples

View File

@@ -11,6 +11,13 @@ A SQLite3 storage driver using [mattn/go-sqlite3](https://github.com/mattn/go-sq
### Signatures ### Signatures
```go ```go
func New(config ...Config) Storage 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 ### Examples