mirror of
https://github.com/gofiber/storage.git
synced 2025-12-18 16:28:22 +08:00
Merge branch 'main' into dependabot/go_modules/postgres/github.com/jackc/pgx/v5-5.6.0
This commit is contained in:
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@@ -80,6 +80,12 @@ updates:
|
||||
- "🤖 Dependencies"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/mockstorage/" # Location of package manifests
|
||||
labels:
|
||||
- "🤖 Dependencies"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/mongodb/" # Location of package manifests
|
||||
labels:
|
||||
|
||||
50
.github/release-drafter-mockstorage.yml
vendored
Normal file
50
.github/release-drafter-mockstorage.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name-template: 'MockStorage - v$RESOLVED_VERSION'
|
||||
tag-template: 'mockstorage/v$RESOLVED_VERSION'
|
||||
tag-prefix: mockstorage/v
|
||||
include-paths:
|
||||
- mockstorage
|
||||
categories:
|
||||
- title: '❗ Breaking Changes'
|
||||
labels:
|
||||
- '❗ BreakingChange'
|
||||
- title: '🚀 New'
|
||||
labels:
|
||||
- '✏️ Feature'
|
||||
- title: '🧹 Updates'
|
||||
labels:
|
||||
- '🧹 Updates'
|
||||
- '🤖 Dependencies'
|
||||
- title: '🐛 Fixes'
|
||||
labels:
|
||||
- '☢️ Bug'
|
||||
- title: '📚 Documentation'
|
||||
labels:
|
||||
- '📒 Documentation'
|
||||
change-template: '- $TITLE (#$NUMBER)'
|
||||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
|
||||
exclude-contributors:
|
||||
- dependabot
|
||||
- dependabot[bot]
|
||||
version-resolver:
|
||||
major:
|
||||
labels:
|
||||
- 'major'
|
||||
- '❗ BreakingChange'
|
||||
minor:
|
||||
labels:
|
||||
- 'minor'
|
||||
- '✏️ Feature'
|
||||
patch:
|
||||
labels:
|
||||
- 'patch'
|
||||
- '📒 Documentation'
|
||||
- '☢️ Bug'
|
||||
- '🤖 Dependencies'
|
||||
- '🧹 Updates'
|
||||
default: patch
|
||||
template: |
|
||||
$CHANGES
|
||||
|
||||
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...mockstorage/v$RESOLVED_VERSION
|
||||
|
||||
Thank you $CONTRIBUTORS for making this update possible.
|
||||
19
.github/workflows/release-drafter-mockstorage.yml
vendored
Normal file
19
.github/workflows/release-drafter-mockstorage.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Release Drafter MockStorage
|
||||
on:
|
||||
push:
|
||||
# branches to consider in the event; optional, defaults to all
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- 'mockstorage/**'
|
||||
jobs:
|
||||
draft_release_memcache:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v6
|
||||
with:
|
||||
config-name: release-drafter-mockstorage.yml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
28
.github/workflows/test-mockstorage.yml
vendored
Normal file
28
.github/workflows/test-mockstorage.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- 'mockstorage/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'mockstorage/**'
|
||||
name: "Tests Local Storage"
|
||||
jobs:
|
||||
Tests:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version:
|
||||
- 1.21.x
|
||||
- 1.22.x
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '${{ matrix.go-version }}'
|
||||
- name: Test Mockstorage
|
||||
run: cd ./mockstorage && go test ./... -v -race
|
||||
@@ -62,6 +62,7 @@ type Storage interface {
|
||||
- [Memcache](./memcache/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Memcache%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-memcache.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [Memory](./memory/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Local+Storage%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-memory.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [Minio](./minio/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Minio%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-minio.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [MockStorage](./mockstorage/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+MockStorage%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-mockstorage.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [MongoDB](./mongodb/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Mongodb%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-mongodb.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [MSSQL](./mssql/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+MSSQL%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-mssql.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [MySQL](./mysql/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+MySQL%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-mysql.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
|
||||
@@ -3,16 +3,16 @@ module github.com/gofiber/storage/cloudflarekv
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/cloudflare/cloudflare-go v0.96.0
|
||||
github.com/cloudflare/cloudflare-go v0.97.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/goccy/go-json v0.10.3 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.6 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/net v0.25.0 // indirect
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
github.com/cloudflare/cloudflare-go v0.96.0 h1:wd+qrnyw+C2eXUUujE6BzFEOREkEfoCvogpO5h33FxI=
|
||||
github.com/cloudflare/cloudflare-go v0.96.0/go.mod h1:gLP9fJT8ROgRCjHNKxISNNKeU1JEg2yT5uPEEI8x9Ec=
|
||||
github.com/cloudflare/cloudflare-go v0.97.0 h1:feZRGiRF1EbljnNIYdt8014FnOLtC3CCvgkLXu915ks=
|
||||
github.com/cloudflare/cloudflare-go v0.97.0/go.mod h1:JXRwuTfHpe5xFg8xytc2w0XC6LcrFsBVMS4WlVaiGg8=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
|
||||
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
||||
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
@@ -16,8 +16,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
|
||||
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-retryablehttp v0.7.6 h1:TwRYfx2z2C4cLbXmT8I5PgP/xmuqASDyiVuGYfs9GZM=
|
||||
github.com/hashicorp/go-retryablehttp v0.7.6/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
|
||||
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
|
||||
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
|
||||
@@ -3,26 +3,26 @@ module github.com/gofiber/storage/dynamodb/v2
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.0
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.16
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.16
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.20
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.6
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.2
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.17
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.18
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.0
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.7
|
||||
github.com/stretchr/testify v1.9.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 // indirect
|
||||
github.com/aws/smithy-go v1.20.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.0 h1:7bZWKoXhzI+mMR/HjdMx8ZCC5+6fY0lS5tr0bbgiLlo=
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.0/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.16 h1:knpCuH7laFVGYTNd99Ns5t+8PuRjDn4HnnZK48csipM=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.16/go.mod h1:vutqgRhDUktwSge3hrC3nkuirzkJ4E/mLj5GvI0BQas=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.16 h1:7d2QxY83uYl0l58ceyiSpxg9bSbStqBC6BeEeHEchwo=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.16/go.mod h1:Ae6li/6Yc6eMzysRL2BXlPYvnrLLBg3D11/AmOjw50k=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.20 h1:Tb9z3/GkyjD16ngZBZjOAsOXvKSkBKahQm37SCxOXhY=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.20/go.mod h1:43wfYl5jBLYjUoZcmW4OzbXKe38VvaMYNXp2+oIwREg=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 h1:dQLK4TjtnlRGb0czOht2CevZ5l6RSyRWAnKeGd7VAFE=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3/go.mod h1:TL79f2P6+8Q7dTsILpiVST+AL9lkF6PPGI167Ny0Cjw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 h1:lf/8VTF2cM+N4SLzaYJERKEWAXq8MOMpZfU6wEPWsPk=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7/go.mod h1:4SjkU7QiqK2M9oozyMzfZ/23LmUY+h3oFqhdeP5OMiI=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 h1:4OYVp0705xu8yjdyoWix0r9wPIRXnIzzOoUpQVHIJ/g=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7/go.mod h1:vd7ESTEvI76T2Na050gODNmNU7+OyKrIKroYTu4ABiI=
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.2 h1:pLsTXqX93rimAOZG2FIYraDQstZaaGVVN4tNw65v0h8=
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.2/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.17 h1:L0JZN7Gh7pT6u5CJReKsLhGKparqNKui+mcpxMXjDZc=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.17/go.mod h1:MzM3balLZeaafYcPz8IihAmam/aCz6niPQI0FdprxW0=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.18 h1:D/ALDWqK4JdY3OFgA2thcPO1c9aYTT5STS/CvnkqY1c=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.18/go.mod h1:JuitCWq+F5QGUrmMPsk945rop6bB57jdscu+Glozdnc=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.0 h1:RXHz/z13XYIOCUxjU8erQm25Hhe9LqtXS3dKXsHWRHs=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.0/go.mod h1:TH3KH06Ijq3zujEw5Gb2xzBMQ+WjpCcJYkGUclCu2NQ=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 h1:dDgptDO9dxeFkXy+tEgVkzSClHZje/6JkPW5aZyEvrQ=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5/go.mod h1:gjvE2KBUgUQhcv89jqxrIxH9GaKs1JbZzWejj/DaHGA=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 h1:cy8ahBJuhtM8GTTSyOkfy6WVPV1IE+SS5/wfXUYuulw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9/go.mod h1:CZBXGLaJnEZI6EVNcPd7a6B5IC5cA/GkRWtu9fp3S6Y=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 h1:A4SYk07ef04+vxZToz9LWvAXl9LW0NClpPpMsi31cz0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9/go.mod h1:5jJcHuwDagxN+ErjQ3PU3ocf6Ylc/p9x+BLO/+X4iXw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.6 h1:170E8A7abwLNy8wF53Wu496IaIlQ+DYQLgCbTqhYf/M=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.6/go.mod h1:uNhUf9Z3MT6Ex+u0ADa8r3MKK5zjuActEfXQPo4YqEI=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.8 h1:PapW7iWHqua6Gk+qRjgXpM3fNqUxY3N+1WURHPcmKhc=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.8/go.mod h1:IL6qnQxrc/qIjwzeg7USP3P7ySEehOPpXJslRbXNYJ4=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.7 h1:Y0pFOzMrx/c6mVswi99Y9UmBfbBhmFsAzuaJDXTHd0U=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.7/go.mod h1:CYR+43Fe0qazBzSTrIwSK7uYdYVf958kwGF+EQgQqhw=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.9 h1:KYj1jyicyjXmWgMFPMBsgZPYoQ3ZO2HZ0u/rnhJ3fZU=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.9/go.mod h1:PWKopbFpAtnHJ0paxgo+m3+dGKJ2BqeE1qeo5O4T8w0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.8 h1:yEeIld7Fh/2iM4pYeQw8a3kH6OYcyIn6lwKlUFiVk7Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.8/go.mod h1:lZJMX2Z5/rQ6OlSbBnW1WWScK6ngLt43xtqM8voMm2w=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 h1:Wx0rlZoEJR7JwlSZcHnEa7CNjrSIyVxMFWGAaXy4fJY=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9/go.mod h1:aVMHdE0aHO3v+f/iw01fmXV/5DbfQ3Bi9nN7nd9bE9Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.9 h1:aD7AGQhvPuAxlSUfo0CWU7s6FpkbyykMhGYMvlqTjVs=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.9/go.mod h1:c1qtZUWtygI6ZdvKppzCSXsDOq5I4luJPZ0Ud3juFCA=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3 h1:Pav5q3cA260Zqez42T9UhIlsd9QeypszRPwC9LdSSsQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3/go.mod h1:9lmoVDVLz/yUZwLaQ676TK02fhCu4+PgRSmMaKR1ozk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.10 h1:69tpbPED7jKPyzMcrwSvhWcJ9bPnZsZs18NT40JwM0g=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.10/go.mod h1:0Aqn1MnEuitqfsCNyKsdKLhDUOr4txD/g19EfiUqgws=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.9 h1:497Dd5t4c87GRuKTSNbkVDksiDVbksjfrTyUy1MzR00=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.9/go.mod h1:5OLOnU8LbdA3RXpLmE5AlLnOPb7nfJ2/kNtJBSNdyXM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 h1:o4T+fKxA3gTMcluBNZZXE9DNaMkJuUL1O3mffCUjoJo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11/go.mod h1:84oZdJ+VjuJKs9v1UTC9NaodRZRseOXCTgku+vQJWR8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 h1:gEYM2GSpr4YNWc6hCd5nod4+d4kd9vWIAWrmGuLdlMw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11/go.mod h1:gVvwPdPNYehHSP9Rs7q27U1EU+3Or2ZpXvzAYJNh63w=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 h1:iXjh3uaH3vsVcnyZX7MqCoCfcyxIrVE9iOQruRaWPrQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5/go.mod h1:5ZXesEuy/QcO0WUnt+4sDkxhdXRHTu2yG0uCSH8B6os=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 h1:M/1u4HBpwLuMtjlxuI2y6HoVLzF5e2mfxHCg7ZVMYmk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12/go.mod h1:kcfd+eTdEi/40FIbLq4Hif3XMXnl5b/+t/KTfLt9xIk=
|
||||
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
|
||||
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
||||
171
mockstorage/README.md
Normal file
171
mockstorage/README.md
Normal file
@@ -0,0 +1,171 @@
|
||||
---
|
||||
id: mockstorage
|
||||
title: MockStorage
|
||||
---
|
||||
|
||||
|
||||

|
||||
[](https://gofiber.io/discord)
|
||||

|
||||

|
||||

|
||||
|
||||
A mock storage implementation for Fiber. This storage is not persistent and is only used for testing purposes.
|
||||
|
||||
**Note: Requires Go 1.21 and above**
|
||||
|
||||
## Table of Contents
|
||||
- [Signatures](#signatures)
|
||||
- [Installation](#installation)
|
||||
- [Examples](#examples)
|
||||
- [Config](#config)
|
||||
- [Default Config](#default-config)
|
||||
|
||||
|
||||
## Signatures
|
||||
|
||||
### Structs
|
||||
|
||||
```go
|
||||
type Storage struct {
|
||||
// contains filtered or unexported fields
|
||||
}
|
||||
|
||||
type Entry struct {
|
||||
Value []byte
|
||||
Exp time.Time
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
CustomFuncs *CustomFuncs
|
||||
}
|
||||
|
||||
type CustomFuncs struct {
|
||||
GetFunc func(key string) ([]byte, error)
|
||||
SetFunc func(key string, val []byte, exp time.Duration) error
|
||||
DeleteFunc func(key string) error
|
||||
ResetFunc func() error
|
||||
CloseFunc func() error
|
||||
ConnFunc func() map[string]Entry
|
||||
KeysFunc func() ([][]byte, error)
|
||||
}
|
||||
```
|
||||
|
||||
### Functions
|
||||
```go
|
||||
// New creates a new Storage instance. You can optionally pass a Config.
|
||||
func New(config ...Config) *Storage
|
||||
|
||||
// Get retrieves the value associated with the given key.
|
||||
func (s *Storage) Get(key string) ([]byte, error)
|
||||
|
||||
// Set sets the value for the given key, with an optional expiration duration.
|
||||
func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
|
||||
// Delete removes the value associated with the given key.
|
||||
func (s *Storage) Delete(key string) error
|
||||
|
||||
// Reset clears all values from the storage.
|
||||
func (s *Storage) Reset() error
|
||||
|
||||
// Close performs any necessary cleanup when the storage is no longer needed.
|
||||
func (s *Storage) Close() error
|
||||
|
||||
// Conn returns a copy of the current state of the storage.
|
||||
func (s *Storage) Conn() map[string]Entry
|
||||
|
||||
// Keys returns a list of all keys in the storage.
|
||||
func (s *Storage) Keys() ([][]byte, error)
|
||||
|
||||
// SetCustomFuncs allows you to set custom functions for the storage operations.
|
||||
func (s *Storage) SetCustomFuncs(custom *CustomFuncs)
|
||||
```
|
||||
|
||||
## 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>
|
||||
```
|
||||
And then install the mockstorage implementation:
|
||||
```bash
|
||||
go get github.com/gofiber/storage/mockstorage
|
||||
```
|
||||
|
||||
## Examples
|
||||
Import the storage package.
|
||||
```go
|
||||
import "github.com/gofiber/storage/mockstorage"
|
||||
```
|
||||
|
||||
You can use the following possibilities to create a storage:
|
||||
```go
|
||||
// Initialize default config
|
||||
store := mockstorage.New()
|
||||
|
||||
// Set a value in the storage.
|
||||
err := store.Set("key1", []byte("value1"), 0)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
// Get a value from the storage.
|
||||
val, err := store.Get("key1")
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
fmt.Println(string(val)) // prints "value1"
|
||||
|
||||
// Delete a value from the storage.
|
||||
err = store.Delete("key1")
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
// Mocking storage operations in tests:
|
||||
func TestMyFunction(t *testing.T) {
|
||||
// Create a new instance of MockStorage
|
||||
store := mockstorage.New()
|
||||
|
||||
// Mock the Set function
|
||||
store.SetCustomFuncs(&mockstorage.CustomFuncs{
|
||||
Set: func(key string, val []byte, exp time.Duration) error {
|
||||
if key == "expectedKey" && string(val) == "expectedValue" {
|
||||
return nil
|
||||
}
|
||||
return errors.New("unexpected key or value")
|
||||
},
|
||||
})
|
||||
|
||||
// Call the function you want to test, which should call store.Set
|
||||
err := MyFunction(store)
|
||||
|
||||
// Check that the function behaved as expected
|
||||
if err != nil {
|
||||
t.Errorf("MyFunction returned an error: %v", err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> **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
|
||||
```go
|
||||
type Config struct {
|
||||
CustomFuncs *CustomFuncs
|
||||
}
|
||||
```
|
||||
|
||||
## Default Config
|
||||
```go
|
||||
var ConfigDefault = Config{
|
||||
CustomFuncs: &CustomFuncs{
|
||||
GetFunc: nil,
|
||||
SetFunc: nil,
|
||||
DeleteFunc: nil,
|
||||
ResetFunc: nil,
|
||||
CloseFunc: nil,
|
||||
ConnFunc: nil,
|
||||
KeysFunc: nil,
|
||||
},
|
||||
}
|
||||
```
|
||||
3
mockstorage/go.mod
Normal file
3
mockstorage/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module mockstorage
|
||||
|
||||
go 1.21
|
||||
0
mockstorage/go.sum
Normal file
0
mockstorage/go.sum
Normal file
170
mockstorage/mockstorage.go
Normal file
170
mockstorage/mockstorage.go
Normal file
@@ -0,0 +1,170 @@
|
||||
package mockstorage
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Config defines the config for mock storage.
|
||||
type Config struct {
|
||||
CustomFuncs *CustomFuncs
|
||||
}
|
||||
|
||||
// Storage is the mock storage adapter.
|
||||
type Storage struct {
|
||||
mu sync.RWMutex
|
||||
data map[string]Entry
|
||||
custom *CustomFuncs
|
||||
}
|
||||
|
||||
// Entry struct to hold value and expiration time.
|
||||
type Entry struct {
|
||||
Value []byte
|
||||
Exp time.Time
|
||||
}
|
||||
|
||||
// CustomFuncs allows injecting custom behaviors for testing.
|
||||
type CustomFuncs struct {
|
||||
GetFunc func(key string) ([]byte, error)
|
||||
SetFunc func(key string, val []byte, exp time.Duration) error
|
||||
DeleteFunc func(key string) error
|
||||
ResetFunc func() error
|
||||
CloseFunc func() error
|
||||
ConnFunc func() map[string]Entry
|
||||
KeysFunc func() ([][]byte, error)
|
||||
}
|
||||
|
||||
// New creates a new mock storage with optional configuration.
|
||||
func New(config ...Config) *Storage {
|
||||
s := &Storage{
|
||||
data: make(map[string]Entry),
|
||||
custom: &CustomFuncs{
|
||||
GetFunc: nil,
|
||||
SetFunc: nil,
|
||||
DeleteFunc: nil,
|
||||
ResetFunc: nil,
|
||||
CloseFunc: nil,
|
||||
ConnFunc: nil,
|
||||
KeysFunc: nil,
|
||||
},
|
||||
}
|
||||
|
||||
// If a config is provided and it has CustomFuncs, use them
|
||||
if len(config) > 0 && config[0].CustomFuncs != nil {
|
||||
s.custom = config[0].CustomFuncs
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// Get retrieves the value for a given key.
|
||||
func (s *Storage) Get(key string) ([]byte, error) {
|
||||
if s.custom.GetFunc != nil {
|
||||
return s.custom.GetFunc(key)
|
||||
}
|
||||
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
e, ok := s.data[key]
|
||||
if !ok {
|
||||
return nil, errors.New("key not found")
|
||||
}
|
||||
if !e.Exp.IsZero() && time.Now().After(e.Exp) {
|
||||
delete(s.data, key)
|
||||
return nil, errors.New("key expired")
|
||||
}
|
||||
return e.Value, nil
|
||||
}
|
||||
|
||||
// Set sets the value for a given key with an expiration time.
|
||||
func (s *Storage) Set(key string, val []byte, exp time.Duration) error {
|
||||
if s.custom.SetFunc != nil {
|
||||
return s.custom.SetFunc(key, val, exp)
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
var expTime time.Time
|
||||
if exp > 0 {
|
||||
expTime = time.Now().Add(exp)
|
||||
}
|
||||
|
||||
s.data[key] = Entry{Value: val, Exp: expTime}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete removes a key from the storage.
|
||||
func (s *Storage) Delete(key string) error {
|
||||
if s.custom.DeleteFunc != nil {
|
||||
return s.custom.DeleteFunc(key)
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
delete(s.data, key)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reset clears all keys from the storage.
|
||||
func (s *Storage) Reset() error {
|
||||
if s.custom.ResetFunc != nil {
|
||||
return s.custom.ResetFunc()
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
s.data = make(map[string]Entry)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close closes the storage (no-op for mock).
|
||||
func (s *Storage) Close() error {
|
||||
if s.custom.CloseFunc != nil {
|
||||
return s.custom.CloseFunc()
|
||||
}
|
||||
|
||||
// No resources to clean up in mock
|
||||
return nil
|
||||
}
|
||||
|
||||
// Conn returns the internal data map (for testing purposes).
|
||||
func (s *Storage) Conn() map[string]Entry {
|
||||
if s.custom.ConnFunc != nil {
|
||||
return s.custom.ConnFunc()
|
||||
}
|
||||
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
copyData := make(map[string]Entry)
|
||||
for k, v := range s.data {
|
||||
copyData[k] = Entry{Value: v.Value, Exp: v.Exp}
|
||||
}
|
||||
return copyData
|
||||
}
|
||||
|
||||
// Keys returns all keys in the storage.
|
||||
func (s *Storage) Keys() ([][]byte, error) {
|
||||
if s.custom.KeysFunc != nil {
|
||||
return s.custom.KeysFunc()
|
||||
}
|
||||
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
keys := make([][]byte, 0, len(s.data))
|
||||
for k := range s.data {
|
||||
keys = append(keys, []byte(k))
|
||||
}
|
||||
return keys, nil
|
||||
}
|
||||
|
||||
// SetCustomFuncs allows setting custom function implementations.
|
||||
func (s *Storage) SetCustomFuncs(custom *CustomFuncs) {
|
||||
s.custom = custom
|
||||
}
|
||||
276
mockstorage/mockstorage_test.go
Normal file
276
mockstorage/mockstorage_test.go
Normal file
@@ -0,0 +1,276 @@
|
||||
package mockstorage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestStorageDefaultBehavior(t *testing.T) {
|
||||
store := New()
|
||||
|
||||
// Test Set and Get
|
||||
err := store.Set("key1", []byte("value1"), 0)
|
||||
if err != nil {
|
||||
t.Fatalf("Set() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
|
||||
val, err := store.Get("key1")
|
||||
if err != nil {
|
||||
t.Fatalf("Get() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
if !bytes.Equal(val, []byte("value1")) {
|
||||
t.Errorf("Get() = %v, want %v", val, []byte("value1"))
|
||||
}
|
||||
|
||||
// Test Delete
|
||||
err = store.Delete("key1")
|
||||
if err != nil {
|
||||
t.Fatalf("Delete() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
|
||||
_, err = store.Get("key1")
|
||||
if err == nil {
|
||||
t.Errorf("Get() error = %v, wantErr %v", err, "key not found")
|
||||
}
|
||||
|
||||
// Test Reset
|
||||
err = store.Set("key2", []byte("value2"), 0)
|
||||
if err != nil {
|
||||
t.Fatalf("Set() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
|
||||
err = store.Reset()
|
||||
if err != nil {
|
||||
t.Fatalf("Reset() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
|
||||
_, err = store.Get("key2")
|
||||
if err == nil {
|
||||
t.Errorf("Get() error = %v, wantErr %v", err, "key not found")
|
||||
}
|
||||
|
||||
// Test Expiry
|
||||
err = store.Set("key3", []byte("value3"), time.Millisecond*100)
|
||||
if err != nil {
|
||||
t.Fatalf("Set() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
time.Sleep(time.Millisecond * 200)
|
||||
|
||||
_, err = store.Get("key3")
|
||||
if err == nil {
|
||||
t.Errorf("Get() error = %v, wantErr %v", err, "key expired")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageConnFunc(t *testing.T) {
|
||||
store := New()
|
||||
|
||||
customFuncs := &CustomFuncs{
|
||||
ConnFunc: func() map[string]Entry {
|
||||
return map[string]Entry{
|
||||
"customKey1": {Value: []byte("customValue1"), Exp: time.Time{}},
|
||||
"customKey2": {Value: []byte("customValue2"), Exp: time.Now().Add(1 * time.Hour)},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
store.SetCustomFuncs(customFuncs)
|
||||
|
||||
// Test custom Conn
|
||||
conn := store.Conn()
|
||||
expectedConn := map[string]Entry{
|
||||
"customKey1": {Value: []byte("customValue1"), Exp: time.Time{}},
|
||||
"customKey2": {Value: []byte("customValue2"), Exp: time.Now().Add(1 * time.Hour)},
|
||||
}
|
||||
|
||||
for k, v := range expectedConn {
|
||||
if val, ok := conn[k]; !ok || !bytes.Equal(val.Value, v.Value) {
|
||||
t.Errorf("Conn() = %v, want %v", conn, expectedConn)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestResetFunc(t *testing.T) {
|
||||
store := New()
|
||||
|
||||
customFuncs := &CustomFuncs{
|
||||
ResetFunc: func() error {
|
||||
return errors.New("reset error")
|
||||
},
|
||||
}
|
||||
|
||||
store.SetCustomFuncs(customFuncs)
|
||||
|
||||
err := store.Reset()
|
||||
if err == nil {
|
||||
t.Errorf("Reset() error = %v, wantErr %v", err, "reset error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageCloseFunc(t *testing.T) {
|
||||
store := New()
|
||||
|
||||
customFuncs := &CustomFuncs{
|
||||
CloseFunc: func() error {
|
||||
return errors.New("close error")
|
||||
},
|
||||
}
|
||||
|
||||
store.SetCustomFuncs(customFuncs)
|
||||
|
||||
err := store.Close()
|
||||
if err == nil {
|
||||
t.Errorf("Close() error = %v, wantErr %v", err, "close error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageKeysFunc(t *testing.T) {
|
||||
store := New()
|
||||
|
||||
customFuncs := &CustomFuncs{
|
||||
KeysFunc: func() ([][]byte, error) {
|
||||
return [][]byte{[]byte("customKey1"), []byte("customKey2")}, nil
|
||||
},
|
||||
}
|
||||
|
||||
store.SetCustomFuncs(customFuncs)
|
||||
|
||||
// Test custom Keys
|
||||
keys, err := store.Keys()
|
||||
if err != nil {
|
||||
t.Fatalf("Keys() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
expectedKeys := [][]byte{[]byte("customKey1"), []byte("customKey2")}
|
||||
if len(keys) != len(expectedKeys) {
|
||||
t.Fatalf("Keys() = %v, want %v", keys, expectedKeys)
|
||||
}
|
||||
for i, key := range expectedKeys {
|
||||
if !bytes.Equal(keys[i], key) {
|
||||
t.Errorf("Keys() = %v, want %v", keys, expectedKeys)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageCustomBehavior(t *testing.T) {
|
||||
store := New()
|
||||
customFuncs := &CustomFuncs{
|
||||
GetFunc: func(key string) ([]byte, error) {
|
||||
if key == "customKey" {
|
||||
return []byte("customValue"), nil
|
||||
}
|
||||
return nil, errors.New("custom key not found")
|
||||
},
|
||||
SetFunc: func(key string, val []byte, exp time.Duration) error {
|
||||
if key == "readonly" {
|
||||
return errors.New("cannot set readonly key")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
DeleteFunc: func(key string) error {
|
||||
if key == "protectedKey" {
|
||||
return errors.New("cannot delete protected key")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
ConnFunc: func() map[string]Entry {
|
||||
return map[string]Entry{
|
||||
"customKey1": {Value: []byte("customValue1"), Exp: time.Time{}},
|
||||
"customKey2": {Value: []byte("customValue2"), Exp: time.Now().Add(1 * time.Hour)},
|
||||
}
|
||||
},
|
||||
KeysFunc: func() ([][]byte, error) {
|
||||
return [][]byte{[]byte("customKey1"), []byte("customKey2")}, nil
|
||||
},
|
||||
}
|
||||
|
||||
store.SetCustomFuncs(customFuncs)
|
||||
|
||||
// Test custom Get
|
||||
val, err := store.Get("customKey")
|
||||
if err != nil {
|
||||
t.Fatalf("Get() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
if !bytes.Equal(val, []byte("customValue")) {
|
||||
t.Errorf("Get() = %v, want %v", val, []byte("customValue"))
|
||||
}
|
||||
|
||||
_, err = store.Get("unknownKey")
|
||||
if err == nil {
|
||||
t.Errorf("Get() error = %v, wantErr %v", err, "custom key not found")
|
||||
}
|
||||
|
||||
// Test custom Set
|
||||
err = store.Set("readonly", []byte("value"), 0)
|
||||
if err == nil {
|
||||
t.Errorf("Set() error = %v, wantErr %v", err, "cannot set readonly key")
|
||||
}
|
||||
|
||||
err = store.Set("regularKey", []byte("value"), 0)
|
||||
if err != nil {
|
||||
t.Fatalf("Set() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
|
||||
// Test custom Delete
|
||||
err = store.Delete("protectedKey")
|
||||
if err == nil {
|
||||
t.Errorf("Delete() error = %v, wantErr %v", err, "cannot delete protected key")
|
||||
}
|
||||
|
||||
err = store.Delete("regularKey")
|
||||
if err != nil {
|
||||
t.Fatalf("Delete() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
|
||||
// Test custom Conn
|
||||
conn := store.Conn()
|
||||
expectedConn := map[string]Entry{
|
||||
"customKey1": {Value: []byte("customValue1"), Exp: time.Time{}},
|
||||
"customKey2": {Value: []byte("customValue2"), Exp: time.Now().Add(1 * time.Hour)},
|
||||
}
|
||||
|
||||
for k, v := range expectedConn {
|
||||
if val, ok := conn[k]; !ok || !bytes.Equal(val.Value, v.Value) {
|
||||
t.Errorf("Conn() = %v, want %v", conn, expectedConn)
|
||||
}
|
||||
}
|
||||
|
||||
// Test custom Keys
|
||||
keys, err := store.Keys()
|
||||
if err != nil {
|
||||
t.Fatalf("Keys() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
expectedKeys := [][]byte{[]byte("customKey1"), []byte("customKey2")}
|
||||
if len(keys) != len(expectedKeys) {
|
||||
t.Fatalf("Keys() = %v, want %v", keys, expectedKeys)
|
||||
}
|
||||
for i, key := range expectedKeys {
|
||||
if !bytes.Equal(keys[i], key) {
|
||||
t.Errorf("Keys() = %v, want %v", keys, expectedKeys)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageConnAndKeys(t *testing.T) {
|
||||
store := New()
|
||||
|
||||
// Test Conn
|
||||
err := store.Set("key1", []byte("value1"), 0)
|
||||
if err != nil {
|
||||
t.Fatalf("Set() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
conn := store.Conn()
|
||||
if val, ok := conn["key1"]; !ok || !bytes.Equal(val.Value, []byte("value1")) {
|
||||
t.Errorf("Conn() = %v, want %v", conn, map[string]Entry{"key1": {Value: []byte("value1"), Exp: time.Time{}}})
|
||||
}
|
||||
|
||||
// Test Keys
|
||||
keys, err := store.Keys()
|
||||
if err != nil {
|
||||
t.Fatalf("Keys() error = %v, wantErr %v", err, nil)
|
||||
}
|
||||
if len(keys) != 1 || !bytes.Equal(keys[0], []byte("key1")) {
|
||||
t.Errorf("Keys() = %v, want %v", keys, [][]byte{[]byte("key1")})
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ module github.com/gofiber/storage/redis/v3
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/redis/go-redis/v9 v9.5.2
|
||||
github.com/redis/go-redis/v9 v9.5.3
|
||||
github.com/stretchr/testify v1.9.0
|
||||
)
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/redis/go-redis/v9 v9.5.2 h1:L0L3fcSNReTRGyZ6AqAEN0K56wYeYAwapBIhkvh0f3E=
|
||||
github.com/redis/go-redis/v9 v9.5.2/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||
github.com/redis/go-redis/v9 v9.5.3 h1:fOAp1/uJG+ZtcITgZOfYFmTKPE7n4Vclj1wZFgRciUU=
|
||||
github.com/redis/go-redis/v9 v9.5.3/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
|
||||
30
s3/go.mod
30
s3/go.mod
@@ -3,28 +3,28 @@ module github.com/gofiber/storage/s3/v2
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.0
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.16
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.16
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.21
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.54.3
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.2
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.17
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.18
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.23
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.55.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 // indirect
|
||||
github.com/aws/smithy-go v1.20.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
|
||||
60
s3/go.sum
60
s3/go.sum
@@ -1,39 +1,39 @@
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.0 h1:7bZWKoXhzI+mMR/HjdMx8ZCC5+6fY0lS5tr0bbgiLlo=
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.0/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.2 h1:pLsTXqX93rimAOZG2FIYraDQstZaaGVVN4tNw65v0h8=
|
||||
github.com/aws/aws-sdk-go-v2 v1.27.2/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2/go.mod h1:lPprDr1e6cJdyYeGXnRaJoP4Md+cDBvi2eOj00BlGmg=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.16 h1:knpCuH7laFVGYTNd99Ns5t+8PuRjDn4HnnZK48csipM=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.16/go.mod h1:vutqgRhDUktwSge3hrC3nkuirzkJ4E/mLj5GvI0BQas=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.16 h1:7d2QxY83uYl0l58ceyiSpxg9bSbStqBC6BeEeHEchwo=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.16/go.mod h1:Ae6li/6Yc6eMzysRL2BXlPYvnrLLBg3D11/AmOjw50k=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 h1:dQLK4TjtnlRGb0czOht2CevZ5l6RSyRWAnKeGd7VAFE=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3/go.mod h1:TL79f2P6+8Q7dTsILpiVST+AL9lkF6PPGI167Ny0Cjw=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.21 h1:1v8Ii0MRVGYB/sdhkbxrtolCA7Tp+lGh+5OJTs5vmZ8=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.21/go.mod h1:cxdd1rc8yxCjKz28hi30XN1jDXr2DxZvD44vLxTz/bg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 h1:lf/8VTF2cM+N4SLzaYJERKEWAXq8MOMpZfU6wEPWsPk=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7/go.mod h1:4SjkU7QiqK2M9oozyMzfZ/23LmUY+h3oFqhdeP5OMiI=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 h1:4OYVp0705xu8yjdyoWix0r9wPIRXnIzzOoUpQVHIJ/g=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7/go.mod h1:vd7ESTEvI76T2Na050gODNmNU7+OyKrIKroYTu4ABiI=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.17 h1:L0JZN7Gh7pT6u5CJReKsLhGKparqNKui+mcpxMXjDZc=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.27.17/go.mod h1:MzM3balLZeaafYcPz8IihAmam/aCz6niPQI0FdprxW0=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.18 h1:D/ALDWqK4JdY3OFgA2thcPO1c9aYTT5STS/CvnkqY1c=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.18/go.mod h1:JuitCWq+F5QGUrmMPsk945rop6bB57jdscu+Glozdnc=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 h1:dDgptDO9dxeFkXy+tEgVkzSClHZje/6JkPW5aZyEvrQ=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5/go.mod h1:gjvE2KBUgUQhcv89jqxrIxH9GaKs1JbZzWejj/DaHGA=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.23 h1:g6IHovcexw51hcP0hxsT7Mr3/PG76hZvoodm9tuKuUc=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.23/go.mod h1:8KSZ0CibxgOaPk28CFL4DGBdGrscHJr8FuxB+jnJBaM=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 h1:cy8ahBJuhtM8GTTSyOkfy6WVPV1IE+SS5/wfXUYuulw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9/go.mod h1:CZBXGLaJnEZI6EVNcPd7a6B5IC5cA/GkRWtu9fp3S6Y=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 h1:A4SYk07ef04+vxZToz9LWvAXl9LW0NClpPpMsi31cz0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9/go.mod h1:5jJcHuwDagxN+ErjQ3PU3ocf6Ylc/p9x+BLO/+X4iXw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.7 h1:/FUtT3xsoHO3cfh+I/kCbcMCN98QZRsiFet/V8QkWSs=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.7/go.mod h1:MaCAgWpGooQoCWZnMur97rGn5dp350w2+CeiV5406wE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.8 h1:jH33S0y5Bo5ZVML62JgZhjd/LrtU+vbR8W7XnIE3Srk=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.8/go.mod h1:hD5YwHLOy6k7d6kqcn3me1bFWHOtzhaXstMd6BpdB68=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.9 h1:UXqEWQI0n+q0QixzU0yUUQBZXRd5037qdInTIHFTl98=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.9/go.mod h1:xP6Gq6fzGZT8w/ZN+XvGMZ2RU1LeEs7b2yUP5DN8NY4=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 h1:Wx0rlZoEJR7JwlSZcHnEa7CNjrSIyVxMFWGAaXy4fJY=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9/go.mod h1:aVMHdE0aHO3v+f/iw01fmXV/5DbfQ3Bi9nN7nd9bE9Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.7 h1:uO5XR6QGBcmPyo2gxofYJLFkcVQ4izOoGDNenlZhTEk=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.7/go.mod h1:feeeAYfAcwTReM6vbwjEyDmiGho+YgBhaFULuXDW8kc=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.54.3 h1:57NtjG+WLims0TxIQbjTqebZUKDM03DfM11ANAekW0s=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.54.3/go.mod h1:739CllldowZiPPsDFcJHNF4FXrVxaSGVnZ9Ez9Iz9hc=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.9 h1:aD7AGQhvPuAxlSUfo0CWU7s6FpkbyykMhGYMvlqTjVs=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.9/go.mod h1:c1qtZUWtygI6ZdvKppzCSXsDOq5I4luJPZ0Ud3juFCA=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3 h1:Pav5q3cA260Zqez42T9UhIlsd9QeypszRPwC9LdSSsQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3/go.mod h1:9lmoVDVLz/yUZwLaQ676TK02fhCu4+PgRSmMaKR1ozk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.10 h1:69tpbPED7jKPyzMcrwSvhWcJ9bPnZsZs18NT40JwM0g=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.10/go.mod h1:0Aqn1MnEuitqfsCNyKsdKLhDUOr4txD/g19EfiUqgws=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.10 h1:pkYC5zTOSPXEYJj56b2SOik9AL432i5MT1YVTQbKOK0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.10/go.mod h1:/WNsBOlKWZCG3PMh2aSp8vkyyT/clpMZqOtrnIKqGfk=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 h1:o4T+fKxA3gTMcluBNZZXE9DNaMkJuUL1O3mffCUjoJo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11/go.mod h1:84oZdJ+VjuJKs9v1UTC9NaodRZRseOXCTgku+vQJWR8=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.8 h1:iQNXVs1vtaq+y9M90M4ZIVNORje0qXTscqHLqoOnFS0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.8/go.mod h1:yUQPRlWqGG0lfNsmjbRWKVwgilfBtZTOFSLEYALlAig=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.55.0 h1:6kq0Xql9qiwNGL/Go87ZqR4otg9jnKs71OfWCVbPxLM=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.55.0/go.mod h1:oSkRFuHVWmUY4Ssk16ErGzBqvYEbvORJFzFXzWhTB2s=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 h1:gEYM2GSpr4YNWc6hCd5nod4+d4kd9vWIAWrmGuLdlMw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11/go.mod h1:gVvwPdPNYehHSP9Rs7q27U1EU+3Or2ZpXvzAYJNh63w=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 h1:iXjh3uaH3vsVcnyZX7MqCoCfcyxIrVE9iOQruRaWPrQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5/go.mod h1:5ZXesEuy/QcO0WUnt+4sDkxhdXRHTu2yG0uCSH8B6os=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 h1:M/1u4HBpwLuMtjlxuI2y6HoVLzF5e2mfxHCg7ZVMYmk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12/go.mod h1:kcfd+eTdEi/40FIbLq4Hif3XMXnl5b/+t/KTfLt9xIk=
|
||||
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
|
||||
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
||||
Reference in New Issue
Block a user