Skip to content

Commit

Permalink
docs: Update mockstorage package README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sixcolors committed Jun 4, 2024
1 parent 0fd13ff commit e8f8290
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mockstorage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ A mock storage implementation for Fiber. This storage is not persistent and is o

**Note: Requires Go 1.21 and above**

### Table of Contents
## Table of Contents
- [Signatures](#signatures)
- [Installation](#installation)
- [Examples](#examples)
- [Config](#config)
- [Default Config](#default-config)


### Signatures
## Signatures

#### Structs
### Structs

```go
type Storage struct {
Expand All @@ -51,7 +51,7 @@ type CustomFuncs struct {
}
```

#### Functions
### Functions
```go
// New creates a new Storage instance. You can optionally pass a Config.
func New(config ...Config) *Storage
Expand Down Expand Up @@ -81,7 +81,7 @@ func (s *Storage) Keys() ([][]byte, error)
func (s *Storage) SetCustomFuncs(custom *CustomFuncs)
```

### Installation
## Installation
MockStorage is tested on the 2 last [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:
```bash
go mod init github.com/<user>/<repo>
Expand All @@ -91,7 +91,7 @@ And then install the mockstorage implementation:
go get github.com/gofiber/storage/mockstorage
```

### Examples
## Examples
Import the storage package.
```go
import "github.com/gofiber/storage/mockstorage"
Expand Down Expand Up @@ -148,14 +148,14 @@ func TestMyFunction(t *testing.T) {

> **Note:** In the `mockstorage` package, expiration of data is not handled automatically in the background. The data is only marked as expired and removed when you attempt to `Get()` it after its expiration time. If you're using a custom `Get()` function or accessing the data directly using the `Conn()` function, expired data will not be removed. Keep this in mind when writing your tests.
### Config
## Config
```go
type Config struct {
CustomFuncs *CustomFuncs
}
```

### Default Config
## Default Config
```go
var ConfigDefault = Config{
CustomFuncs: &CustomFuncs{
Expand Down

0 comments on commit e8f8290

Please sign in to comment.