mirror of
https://github.com/gofiber/storage.git
synced 2025-09-27 04:46:08 +08:00
Compare commits
98 Commits
coherence/
...
memory/v2.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5b6559e084 | ||
![]() |
32a3153566 | ||
![]() |
b6cf4057d0 | ||
![]() |
d5968313b3 | ||
![]() |
7638e00caa | ||
![]() |
25737614cf | ||
![]() |
ffe12feafa | ||
![]() |
71c101a0fa | ||
![]() |
a00477e510 | ||
![]() |
c3b4b6e96c | ||
![]() |
ae8f210306 | ||
![]() |
139b0f4870 | ||
![]() |
8749583563 | ||
![]() |
54fa28a305 | ||
![]() |
ca5ced95d7 | ||
![]() |
5c018e302d | ||
![]() |
716f5a4878 | ||
![]() |
464c871e79 | ||
![]() |
56a8596fe9 | ||
![]() |
8ba0110b24 | ||
![]() |
75ce232c9c | ||
![]() |
602deafe0a | ||
![]() |
07fab67bb1 | ||
![]() |
6b21d0af38 | ||
![]() |
9c99c74835 | ||
![]() |
05c797f133 | ||
![]() |
894f364785 | ||
![]() |
b607828b9d | ||
![]() |
32c87e29aa | ||
![]() |
ee8aa518e5 | ||
![]() |
aebce6444e | ||
![]() |
3ee7537cc8 | ||
![]() |
7091428842 | ||
![]() |
6d79796597 | ||
![]() |
fbf0bbef5c | ||
![]() |
50bea20332 | ||
![]() |
22f4401661 | ||
![]() |
0e92f332da | ||
![]() |
7921dc7e37 | ||
![]() |
0b9f4aebc8 | ||
![]() |
2143a67c8d | ||
![]() |
3b5d81397c | ||
![]() |
af89d59508 | ||
![]() |
74f7e9b4c9 | ||
![]() |
ddac78a1dd | ||
![]() |
0591ba2589 | ||
![]() |
f602540e53 | ||
![]() |
05194dded6 | ||
![]() |
957cba4743 | ||
![]() |
2a41f5c60f | ||
![]() |
f6eab90d0b | ||
![]() |
f415c93d8b | ||
![]() |
cf8e97a71b | ||
![]() |
ac0c464e5b | ||
![]() |
4457e96f9b | ||
![]() |
ddb765f758 | ||
![]() |
cd80e17ce8 | ||
![]() |
edb77f865f | ||
![]() |
a2e3e4fced | ||
![]() |
c3431ff1af | ||
![]() |
62ebac1d4f | ||
![]() |
3f4bff91cd | ||
![]() |
fc00b7501c | ||
![]() |
2ba3adef60 | ||
![]() |
fba0b33855 | ||
![]() |
f33ba7493c | ||
![]() |
1a9f3e144e | ||
![]() |
0732a00253 | ||
![]() |
2f5ae09380 | ||
![]() |
1d0a80e362 | ||
![]() |
7e70887486 | ||
![]() |
99e619ca77 | ||
![]() |
875a5f3081 | ||
![]() |
23cac43c89 | ||
![]() |
6e44e3c729 | ||
![]() |
8a2be493cb | ||
![]() |
b5a1f8aec4 | ||
![]() |
d7b4cc8c6c | ||
![]() |
318be60fa9 | ||
![]() |
56cbe84675 | ||
![]() |
91db8c2e5d | ||
![]() |
e02ca45688 | ||
![]() |
f864d67dbc | ||
![]() |
863767bc9f | ||
![]() |
dca7968160 | ||
![]() |
2fd96adf12 | ||
![]() |
ec64c27225 | ||
![]() |
0dd355a984 | ||
![]() |
495f9835f2 | ||
![]() |
eb70c9cef1 | ||
![]() |
93c051e1a7 | ||
![]() |
e86e48703c | ||
![]() |
145a7fe255 | ||
![]() |
ba555c5a34 | ||
![]() |
b2f5e6ceb7 | ||
![]() |
5eb19f802b | ||
![]() |
23131b83cc | ||
![]() |
2ec67be1e9 |
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@@ -140,3 +140,9 @@ updates:
|
||||
- "🤖 Dependencies"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/scylladb/" # Location of package manifests
|
||||
labels:
|
||||
- "🤖 Dependencies"
|
||||
schedule:
|
||||
interval: "daily"
|
43
.github/release-drafter-scylladb.yml
vendored
Normal file
43
.github/release-drafter-scylladb.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name-template: 'ScyllaDb - v$RESOLVED_VERSION'
|
||||
tag-template: 'scylladb/v$RESOLVED_VERSION'
|
||||
tag-prefix: scylladb/v
|
||||
include-paths:
|
||||
- scylladb
|
||||
categories:
|
||||
- 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.
|
||||
version-resolver:
|
||||
major:
|
||||
labels:
|
||||
- 'major'
|
||||
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...scylladb/v$RESOLVED_VERSION
|
||||
|
||||
Thank you $CONTRIBUTORS for making this update possible.
|
5
.github/workflows/benchmark.yml
vendored
5
.github/workflows/benchmark.yml
vendored
@@ -117,6 +117,11 @@ jobs:
|
||||
run: |
|
||||
docker run -d --restart always -p 9000:9000 --name storage-minio -e MINIO_ROOT_USER='minio-user' -e MINIO_ROOT_PASSWORD='minio-password' minio/minio server /data
|
||||
|
||||
- name: Install ScyllaDb
|
||||
run: |
|
||||
docker run --name scylladb -p 9042:9042 -p 19042:19042 -p 9160:9160 -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9180:9180 -d scylladb/scylla:latest --broadcast-address 127.0.0.1 --listen-address 0.0.0.0 --broadcast-rpc-address 127.0.0.1
|
||||
sleep 15 # Wait for ScyllaDb to initialize
|
||||
|
||||
- name: Setup Redis
|
||||
uses: shogo82148/actions-setup-redis@v1
|
||||
with:
|
||||
|
4
.github/workflows/gosec.yml
vendored
4
.github/workflows/gosec.yml
vendored
@@ -124,3 +124,7 @@ jobs:
|
||||
working-directory: ./rueidis
|
||||
run: gosec ./...
|
||||
# -----
|
||||
- name: Run Gosec (scylladb)
|
||||
working-directory: ./scylladb
|
||||
run: gosec ./...
|
||||
# -----
|
||||
|
19
.github/workflows/release-drafter-scylladb.yml
vendored
Normal file
19
.github/workflows/release-drafter-scylladb.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Release Drafter ScyllaDb
|
||||
on:
|
||||
push:
|
||||
# branches to consider in the event; optional, defaults to all
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- 'scylladb/**'
|
||||
jobs:
|
||||
draft_release_scylladb:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
with:
|
||||
config-name: release-drafter-scylladb.yml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2
.github/workflows/sync-docs.yml
vendored
2
.github/workflows/sync-docs.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
|
3
.github/workflows/test-redis.yml
vendored
3
.github/workflows/test-redis.yml
vendored
@@ -66,6 +66,9 @@ jobs:
|
||||
slave3-port: 7005
|
||||
sleep-duration: 10
|
||||
|
||||
- name: Wait for Redis to Start
|
||||
run: sleep 15
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
|
39
.github/workflows/test-scylladb.yml
vendored
Normal file
39
.github/workflows/test-scylladb.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- 'scylladb/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'scylladb/**'
|
||||
|
||||
name: "Tests ScyllaDb"
|
||||
|
||||
jobs:
|
||||
Tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version:
|
||||
- 1.20.x
|
||||
- 1.21.x
|
||||
|
||||
steps:
|
||||
- name: Fetch Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run ScyllaDb
|
||||
run: |
|
||||
docker run --name scylladb -p 9042:9042 -p 19042:19042 -p 9160:9160 -p 10000:10000 -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9180:9180 -d scylladb/scylla:latest --broadcast-address 127.0.0.1 --listen-address 0.0.0.0 --broadcast-rpc-address 127.0.0.1
|
||||
sleep 30 # Wait for ScyllaDb to initialize
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '${{ matrix.go-version }}'
|
||||
|
||||
- name: Run Test
|
||||
run: cd ./scylladb && go test ./... -v -race
|
@@ -69,5 +69,6 @@ type Storage interface {
|
||||
- [Redis](./redis/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Redis%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-redis.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [Rueidis](./rueidis/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+rueidis%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-rueidis.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [S3](./s3/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+S3%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-s3.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [ScyllaDB](./scylladb/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+scylladb%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-scylladb.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
- [SQLite3](./sqlite3/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Sqlite3%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-sqlite3.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
|
||||
|
||||
|
@@ -3,7 +3,7 @@ module github.com/gofiber/storage/arangodb/v2
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/arangodb/go-driver v1.6.0
|
||||
github.com/arangodb/go-driver v1.6.1
|
||||
github.com/gofiber/utils/v2 v2.0.0-beta.3
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
github.com/arangodb/go-driver v1.6.0 h1:NFWj/idqXZxhFVueihMSI2R9NotNIsgvNfM/xmpekb4=
|
||||
github.com/arangodb/go-driver v1.6.0/go.mod h1:HQmdGkvNMVBTE3SIPSQ8T/ZddC6iwNsfMR+dDJQxIsI=
|
||||
github.com/arangodb/go-driver v1.6.1 h1:bnhrpbA4U1NU13JOWs5sWWYMtQwdjKT0+jkl8dSndyY=
|
||||
github.com/arangodb/go-driver v1.6.1/go.mod h1:ywucwwi34GBxxXFWw/ym+7/66//L4K9abxk/sFJro2k=
|
||||
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e h1:Xg+hGrY2LcQBbxd0ZFdbGSyRKTYMZCfBbw/pMJFOk1g=
|
||||
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e/go.mod h1:mq7Shfa/CaixoDxiyAAc5jZ6CVBAyPaNQCGS7mkj4Ho=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
@@ -5,7 +5,7 @@ go 1.19
|
||||
require (
|
||||
github.com/gofiber/utils/v2 v2.0.0-beta.3
|
||||
github.com/stretchr/testify v1.8.4
|
||||
go.etcd.io/bbolt v1.3.7
|
||||
go.etcd.io/bbolt v1.3.8
|
||||
)
|
||||
|
||||
require (
|
||||
|
@@ -8,8 +8,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
|
||||
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
||||
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
|
||||
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
|
@@ -3,7 +3,7 @@ module github.com/gofiber/storage/coherence
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/oracle/coherence-go-client v1.0.2
|
||||
github.com/oracle/coherence-go-client v1.0.3
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -21,6 +21,6 @@ require (
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
golang.org/x/text v0.13.0 // indirect
|
||||
google.golang.org/grpc v1.57.0 // indirect
|
||||
google.golang.org/grpc v1.58.3 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
)
|
||||
|
@@ -12,8 +12,8 @@ github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
|
||||
github.com/oracle/coherence-go-client v1.0.2 h1:sMIkBoYDJYP3lq6Th1WAJSVKRkqERY8W7auFsoVJGJs=
|
||||
github.com/oracle/coherence-go-client v1.0.2/go.mod h1:CK8c0CpzZpYXthR6U3t1UpJRkllBpabooaxewJ1oT3c=
|
||||
github.com/oracle/coherence-go-client v1.0.3 h1:P8Rzgo21BAaJsKzemzMCFY9I27PdKBpr5ZqrHhZ7zPg=
|
||||
github.com/oracle/coherence-go-client v1.0.3/go.mod h1:IAk8etsxzhUK6YaGzbInR1LYlh+1fiG85bGpyvzY0QY=
|
||||
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/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
@@ -25,10 +25,10 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
|
||||
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
|
||||
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
|
||||
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
|
||||
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
|
@@ -3,12 +3,12 @@ module github.com/gofiber/storage/couchbase/v2
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/couchbase/gocb/v2 v2.6.4
|
||||
github.com/couchbase/gocb/v2 v2.6.5
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/couchbase/gocbcore/v10 v10.2.8 // indirect
|
||||
github.com/couchbase/gocbcore/v10 v10.2.9 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/uuid v1.3.1 // indirect
|
||||
|
@@ -1,7 +1,7 @@
|
||||
github.com/couchbase/gocb/v2 v2.6.4 h1:o5k5JnxYkgamVL9svx+vbXc7vKF5X72tNt/qORs+L30=
|
||||
github.com/couchbase/gocb/v2 v2.6.4/go.mod h1:W/cHlBGfendPh53WzRaF1KIXTovI9DaI7EPeeqIsnmc=
|
||||
github.com/couchbase/gocbcore/v10 v10.2.8 h1:Enjxyxd6XYIP0SSlKxt+GHL0J+A/GaLxGJZ13XCfOW4=
|
||||
github.com/couchbase/gocbcore/v10 v10.2.8/go.mod h1:lYQIIk+tzoMcwtwU5GzPbDdqEkwkH3isI2rkSpfL0oM=
|
||||
github.com/couchbase/gocb/v2 v2.6.5 h1:xaZu29o8UJEV1ZQ3n2s9jcRCUHz/JsQ6+y6JBnVsy5A=
|
||||
github.com/couchbase/gocb/v2 v2.6.5/go.mod h1:0vFM09y+VPhnXeNrIb8tS0wKHGpJvjJBrJnriWEiwGs=
|
||||
github.com/couchbase/gocbcore/v10 v10.2.9 h1:zph/+ceu3JtZEDKhJMTRc6lGrahq+mnlQY/1dSepJuE=
|
||||
github.com/couchbase/gocbcore/v10 v10.2.9/go.mod h1:lYQIIk+tzoMcwtwU5GzPbDdqEkwkH3isI2rkSpfL0oM=
|
||||
github.com/couchbaselabs/gocaves/client v0.0.0-20230307083111-cc3960c624b1/go.mod h1:AVekAZwIY2stsJOMWLAS/0uA/+qdp7pjO8EHnl61QkY=
|
||||
github.com/couchbaselabs/gocaves/client v0.0.0-20230404095311-05e3ba4f0259 h1:2TXy68EGEzIMHOx9UvczR5ApVecwCfQZ0LjkmwMI6g4=
|
||||
github.com/couchbaselabs/gocaves/client v0.0.0-20230404095311-05e3ba4f0259/go.mod h1:AVekAZwIY2stsJOMWLAS/0uA/+qdp7pjO8EHnl61QkY=
|
||||
|
@@ -3,27 +3,27 @@ module github.com/gofiber/storage/dynamodb/v2
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.1
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.44
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.42
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.41
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.22.1
|
||||
github.com/aws/aws-sdk-go-v2 v1.22.1
|
||||
github.com/aws/aws-sdk-go-v2/config v1.22.0
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.15.1
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.0
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.15.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.15.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.1 // indirect
|
||||
github.com/aws/smithy-go v1.15.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.17.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 // indirect
|
||||
github.com/aws/smithy-go v1.16.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
|
@@ -1,42 +1,41 @@
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.1 h1:wjHYshtPpYOZm+/mu3NhVgRRc0baM6LJZOmxPZ5Cwzs=
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.1/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.44 h1:U10NQ3OxiY0dGGozmVIENIDnCT0W432PWxk2VO8wGnY=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.44/go.mod h1:pHxnQBldd0heEdJmolLBk78D1Bf69YnKLY3LOpFImlU=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.42 h1:KMkjpZqcMOwtRHChVlHdNxTUUAC6NC/b58mRZDIdcRg=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.42/go.mod h1:7ltKclhvEB8305sBhrpls24HGxORl6qgnQqSJ314Uw8=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.41 h1:VAf4nqNK8rll9tWH4srq3nq+e0oSx15zoNel+o5/qE4=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.41/go.mod h1:YXdY5/rM8Anc0Ee9SpA0JgvWV9tmBw24qTFRPUT1mhI=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12 h1:3j5lrl9kVQrJ1BU4O0z7MQ8sa+UXdiLuo4j0V+odNI8=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12/go.mod h1:JbFpcHDBdsex1zpIKuVRorZSQiZEyc3MykNCcjgz174=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42 h1:817VqVe6wvwE46xXy6YF5RywvjOX6U2zRQQ6IbQFK0s=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42/go.mod h1:oDfgXoBBmj+kXnqxDDnIDnC56QBosglKp8ftRCTxR+0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36 h1:7ZApaXzWbo8slc+W5TynuUlB4z66g44h7uqa3/d/BsY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36/go.mod h1:rwr4WnmFi3RJO0M4dxbJtgi9BPLMpVBMX1nUte5ha9U=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44 h1:quOJOqlbSfeJTboXLjYXM1M9T52LBXqLoTPlmsKLpBo=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44/go.mod h1:LNy+P1+1LiRcCsVYr/4zG5n8zWFL0xsvZkOybjbftm8=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.22.1 h1:TYq4EU2vEEluoaBG0RCPnbibSndTQSzlpbZdmT/YRcs=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.22.1/go.mod h1:1EJb9/tJwI7iqiStZBcmHijQxcgp7dlPuD2YgoZIrJQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.15.6 h1:19fUnoM1ZfBQvavOVisIVRskTEVqqriSDydHi+BlVhg=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.15.6/go.mod h1:QxkzvI+DXGAgVB4/s8fjbB3BpcNq+Yt0+3mKWG2PrRU=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15 h1:7R8uRYyXzdD71KWVCL78lJZltah6VVznXBazvKjfH58=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15/go.mod h1:26SQUPcTNgV1Tapwdt4a1rOsYRsnBsJHLMPoxK2b0d8=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.36 h1:0ZzowXTZABVqnJnwDMlTDP3eeEkuP1r6RYnhSBmgK2o=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.36/go.mod h1:zAE5h/4VanzBpqyWoCZX/nJImdsqjjsGt2r3MtbKSFA=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36 h1:YXlm7LxwNlauqb2OrinWlcvtsflTzP8GaMvYfQBhoT4=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36/go.mod h1:ou9ffqJ9hKOVZmjlC6kQ6oROAyG1M4yBKzR+9BKbDwk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.15.1 h1:ZN3bxw9OYC5D6umLw6f57rNJfGfhg1DIAAcKpzyUTOE=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.15.1/go.mod h1:PieckvBoT5HtyB9AsJRrYZFY2Z+EyfVM/9zG6gbV8DQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2 h1:fSCCJuT5i6ht8TqGdZc5Q5K9pz/atrf7qH4iK5C9XzU=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2/go.mod h1:5eNtr+vNc5vVd92q7SJ+U/HszsIdhZBEyi9dkMRKsp8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.1 h1:ASNYk1ypWAxRhJjKS0jBnTUeDl7HROOpeSMu1xDA/I8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.1/go.mod h1:2cnsAhVT3mqusovc2stUSUrSBGTcX9nh8Tu6xh//2eI=
|
||||
github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8=
|
||||
github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
|
||||
github.com/aws/aws-sdk-go-v2 v1.22.1 h1:sjnni/AuoTXxHitsIdT0FwmqUuNUuHtufcVDErVFT9U=
|
||||
github.com/aws/aws-sdk-go-v2 v1.22.1/go.mod h1:Kd0OJtkW3Q0M0lUWGszapWjEvrXDzRW+D21JNsroB+c=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.22.0 h1:9Mm99OalzZRz0ab5fpodMoHBApHS6pqRNp3M9NmzvDg=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.22.0/go.mod h1:2eWgw5lps8fKI7LZVTrRTYP6HE6k/uEFUuTSHfXwqP0=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.15.1 h1:hmf6lAm9hk7uLCfapZn/jL05lm6Uwdbn1B0fgjyuf4M=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.15.1/go.mod h1:QTcHga3ZbQOneJuxmGBOCxiClxmp+TlvmjFexAnJ790=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.0 h1:nKmTvugKsuO2bHkL0vkpHEFtRoT/ijOVx0VdP+LLjgw=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.0/go.mod h1:vxJ/EEKuP9CCSG4lEViyU9i5gr2M0X5OIJqTcX/oxuU=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2 h1:gIeH4+o1MN/caGBWjoGQTUTIu94xD6fI5B2+TcwBf70=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2/go.mod h1:wLyMIo/zPOhQhPXTddpfdkSleyigtFi8iMnC+2m/SK4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1 h1:fi1ga6WysOyYb5PAf3Exd6B5GiSNpnZim4h1rhlBqx0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1/go.mod h1:V5CY8wNurvPUibTi9mwqUqpiFZ5LnioKWIFUDtIzdI8=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1 h1:ZpaV/j48RlPc4AmOZuPv22pJliXjXq8/reL63YzyFnw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1/go.mod h1:R8aXraabD2e3qv1csxM14/X9WF4wFMIY0kH4YEtYD5M=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0 h1:DqOQvIfmGkXZUVJnl9VRk0AnxyS59tCtX9k1Pyss4Ak=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0/go.mod h1:VV/Kbw9Mg1GWJOT9WK+oTL3cWZiXtapnNvDSRqTZLsg=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.0 h1:wAG9NailFhGhg8Ngg2YeCtzGmFWc63SYqJKdvN5ZMkE=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.0/go.mod h1:ByrosnNlEq6xkA0d+FwB4f0HH/5KWCcgBqVxAt+Rsps=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.17.0 h1:iTGBKvqZNU9SsQCzRiK8f0u9kVtdG4K1Q68A97JRn6w=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.17.0/go.mod h1:EabdnPA1OVcrolKX/hyMSNvJv8MBCZtlAlncsg/b/rA=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0 h1:CJxo7ZBbaIzmXfV3hjcx36n9V87gJsIUPJflwqEHl3Q=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0/go.mod h1:yjVfjuY4nD1EW9i387Kau+I6V5cBA5YnC/mWNopjZrI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.1 h1:aY45T0Xk+xHHrQPlQrp8IhrgN7k4SL5VF2UXhsmI2rs=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.1/go.mod h1:5E/dXkj2ljMIAvuYaFuYwitKJg6ULwsDbUr3g8izVB0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1 h1:2OXw3ppu1XsB6rqKEMV4tnecTjIY3PRV2U6IP6KPJQo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1/go.mod h1:FZB4AdakIqW/yERVdGJA6Z9jraax1beXfhBBnK2wwR8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 h1:I/Oh3IxGPfHXiGnwM54TD6hNr/8TlUrBXAtTyGhR+zw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.17.0/go.mod h1:H6NCMvDBqA+CvIaXzaSqM6LWtzv9BzZrqBOqz+PzRF8=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 h1:irbXQkfVYIRaewYSXcu4yVk0m2T+JzZd0dkop7FjmO0=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0/go.mod h1:4wPNCkM22+oRe71oydP66K50ojDUC33XutSMi2pEF/M=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 h1:sYIFy8tm1xQwRvVQ4CRuBGXKIg9sHNuG6+3UAQuoujk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0/go.mod h1:S/LOQUeYDfJeJpFCIJDMjy7dwL4aA33HUdVi+i7uH8k=
|
||||
github.com/aws/smithy-go v1.16.0 h1:gJZEH/Fqh+RsvlJ1Zt4tVAtV6bKkp3cC+R6FCZMNzik=
|
||||
github.com/aws/smithy-go v1.16.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
|
||||
|
@@ -4,7 +4,7 @@ go 1.19
|
||||
|
||||
require (
|
||||
github.com/stretchr/testify v1.8.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.9
|
||||
go.etcd.io/etcd/client/v3 v3.5.10
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -14,8 +14,8 @@ require (
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.10 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.25.0 // indirect
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
@@ -24,7 +24,7 @@ require (
|
||||
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||
google.golang.org/grpc v1.57.0 // indirect
|
||||
google.golang.org/grpc v1.58.3 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
16
etcd/go.sum
16
etcd/go.sum
@@ -21,12 +21,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.etcd.io/etcd/api/v3 v3.5.9 h1:4wSsluwyTbGGmyjJktOf3wFQoTBIURXHnq9n/G/JQHs=
|
||||
go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9 h1:oidDC4+YEuSIQbsR94rY9gur91UPL6DnxDCIYd2IGsE=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4=
|
||||
go.etcd.io/etcd/client/v3 v3.5.9 h1:r5xghnU7CwbUxD/fbUtRyJGaYNfDun8sp/gTr1hew6E=
|
||||
go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA=
|
||||
go.etcd.io/etcd/api/v3 v3.5.10 h1:szRajuUUbLyppkhs9K6BRtjY37l66XQQmw7oZRANE4k=
|
||||
go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.10 h1:kfYIdQftBnbAq8pUWFXfpuuxFSKzlmM5cSn76JByiT0=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U=
|
||||
go.etcd.io/etcd/client/v3 v3.5.10 h1:W9TXNZ+oB3MCd/8UjxHTWK5J9Nquw9fQBLJd5ne5/Ao=
|
||||
go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc=
|
||||
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
@@ -69,8 +69,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
|
||||
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
|
||||
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
|
||||
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
|
@@ -31,6 +31,7 @@ func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() map[string]entry
|
||||
func (s *Storage) Keys() ([][]byte, error)
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
@@ -2,14 +2,10 @@ module github.com/gofiber/storage/memory/v2
|
||||
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/gofiber/utils/v2 v2.0.0-beta.3
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
require github.com/stretchr/testify v1.8.4
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/google/uuid v1.3.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
@@ -1,9 +1,5 @@
|
||||
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/gofiber/utils/v2 v2.0.0-beta.3 h1:pfOhUDDVjBJpkWv6C5jaDyYLvpui7zQ97zpyFFsUOKw=
|
||||
github.com/gofiber/utils/v2 v2.0.0-beta.3/go.mod h1:jsl17+MsKfwJjM3ONCE9Rzji/j8XNbwjhUVTjzgfDCo=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
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/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
|
@@ -141,3 +141,29 @@ func (s *Storage) Conn() map[string]entry {
|
||||
defer s.mux.RUnlock()
|
||||
return s.db
|
||||
}
|
||||
|
||||
// Return all the keys
|
||||
func (s *Storage) Keys() ([][]byte, error) {
|
||||
s.mux.RLock()
|
||||
defer s.mux.RUnlock()
|
||||
|
||||
if len(s.db) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
ts := atomic.LoadUint32(&internal.Timestamp)
|
||||
keys := make([][]byte, 0, len(s.db))
|
||||
for key, v := range s.db {
|
||||
// Filter out the expired keys
|
||||
if v.expiry == 0 || v.expiry > ts {
|
||||
keys = append(keys, []byte(key))
|
||||
}
|
||||
}
|
||||
|
||||
// Double check if no valid keys were found
|
||||
if len(keys) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return keys, nil
|
||||
}
|
||||
|
@@ -7,22 +7,26 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var testStore = New()
|
||||
|
||||
func Test_Storage_Memory_Set(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
testStore = New()
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 1)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
testStore = New()
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
@@ -30,12 +34,17 @@ func Test_Storage_Memory_Set_Override(t *testing.T) {
|
||||
|
||||
err = testStore.Set(key, val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 1)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
testStore = New()
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
@@ -44,53 +53,104 @@ func Test_Storage_Memory_Get(t *testing.T) {
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, val, result)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 1)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Set_Expiration(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
exp = 1 * time.Second
|
||||
testStore = New()
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
exp = 1 * time.Second
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, exp)
|
||||
require.NoError(t, err)
|
||||
|
||||
time.Sleep(1100 * time.Millisecond)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Get_Expired(t *testing.T) {
|
||||
key := "john"
|
||||
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Set_Long_Expiration_with_Keys(t *testing.T) {
|
||||
var (
|
||||
testStore = New()
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
exp = 5 * time.Second
|
||||
)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
err = testStore.Set(key, val, exp)
|
||||
require.NoError(t, err)
|
||||
|
||||
time.Sleep(1100 * time.Millisecond)
|
||||
|
||||
keys, err = testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 1)
|
||||
|
||||
time.Sleep(4000 * time.Millisecond)
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err = testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Get_NotExist(t *testing.T) {
|
||||
testStore := New()
|
||||
result, err := testStore.Get("notexist")
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Delete(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
testStore = New()
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 1)
|
||||
|
||||
err = testStore.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err = testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Reset(t *testing.T) {
|
||||
testStore := New()
|
||||
val := []byte("doe")
|
||||
|
||||
err := testStore.Set("john1", val, 0)
|
||||
@@ -99,6 +159,10 @@ func Test_Storage_Memory_Reset(t *testing.T) {
|
||||
err = testStore.Set("john2", val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 2)
|
||||
|
||||
err = testStore.Reset()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -109,17 +173,24 @@ func Test_Storage_Memory_Reset(t *testing.T) {
|
||||
result, err = testStore.Get("john2")
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err = testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Close(t *testing.T) {
|
||||
testStore := New()
|
||||
require.Nil(t, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Storage_Memory_Conn(t *testing.T) {
|
||||
testStore := New()
|
||||
require.True(t, testStore.Conn() != nil)
|
||||
}
|
||||
|
||||
func Benchmark_Memory_Set(b *testing.B) {
|
||||
testStore := New()
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
@@ -132,6 +203,7 @@ func Benchmark_Memory_Set(b *testing.B) {
|
||||
}
|
||||
|
||||
func Benchmark_Memory_Get(b *testing.B) {
|
||||
testStore := New()
|
||||
err := testStore.Set("john", []byte("doe"), 0)
|
||||
require.NoError(b, err)
|
||||
|
||||
@@ -146,6 +218,7 @@ func Benchmark_Memory_Get(b *testing.B) {
|
||||
}
|
||||
|
||||
func Benchmark_Memory_SetAndDelete(b *testing.B) {
|
||||
testStore := New()
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
|
@@ -3,7 +3,7 @@ module github.com/gofiber/storage/postgres/v3
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/jackc/pgx/v5 v5.4.3
|
||||
github.com/jackc/pgx/v5 v5.5.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
|
@@ -6,8 +6,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY=
|
||||
github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=
|
||||
github.com/jackc/pgx/v5 v5.5.0 h1:NxstgwndsTRy7eq9/kqYc/BZh5w2hHJV86wjvO+1xPw=
|
||||
github.com/jackc/pgx/v5 v5.5.0/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=
|
||||
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
|
||||
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
|
@@ -29,6 +29,7 @@ func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() redis.UniversalClient
|
||||
func (s *Storage) Keys() ([][]byte, error)
|
||||
```
|
||||
### Installation
|
||||
Redis 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:
|
||||
|
@@ -3,7 +3,7 @@ module github.com/gofiber/storage/redis/v3
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/redis/go-redis/v9 v9.2.1
|
||||
github.com/redis/go-redis/v9 v9.3.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
|
@@ -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.2.1 h1:WlYJg71ODF0dVspZZCpYmoF1+U1Jjk9Rwd7pq6QmlCg=
|
||||
github.com/redis/go-redis/v9 v9.2.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||
github.com/redis/go-redis/v9 v9.3.0 h1:RiVDjmig62jIWp7Kk4XVLs0hzV6pI3PyTnnL0cnn0u0=
|
||||
github.com/redis/go-redis/v9 v9.3.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
|
@@ -74,8 +74,6 @@ func New(config ...Config) *Storage {
|
||||
}
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
// Get value by key
|
||||
func (s *Storage) Get(key string) ([]byte, error) {
|
||||
if len(key) <= 0 {
|
||||
@@ -118,3 +116,32 @@ func (s *Storage) Close() error {
|
||||
func (s *Storage) Conn() redis.UniversalClient {
|
||||
return s.db
|
||||
}
|
||||
|
||||
// Return all the keys
|
||||
func (s *Storage) Keys() ([][]byte, error) {
|
||||
var keys [][]byte
|
||||
var cursor uint64
|
||||
var err error
|
||||
|
||||
for {
|
||||
var batch []string
|
||||
|
||||
if batch, cursor, err = s.db.Scan(context.Background(), cursor, "*", 10).Result(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, key := range batch {
|
||||
keys = append(keys, []byte(key))
|
||||
}
|
||||
|
||||
if cursor == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if len(keys) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return keys, nil
|
||||
}
|
||||
|
@@ -9,12 +9,11 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var testStore = New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
|
||||
func Test_Redis_Set(t *testing.T) {
|
||||
var (
|
||||
testStore = New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
@@ -25,6 +24,9 @@ func Test_Redis_Set(t *testing.T) {
|
||||
|
||||
func Test_Redis_Set_Override(t *testing.T) {
|
||||
var (
|
||||
testStore = New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
@@ -34,10 +36,17 @@ func Test_Redis_Set_Override(t *testing.T) {
|
||||
|
||||
err = testStore.Set(key, val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 1)
|
||||
}
|
||||
|
||||
func Test_Redis_Get(t *testing.T) {
|
||||
var (
|
||||
testStore = New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
@@ -48,10 +57,17 @@ func Test_Redis_Get(t *testing.T) {
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, val, result)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 1)
|
||||
}
|
||||
|
||||
func Test_Redis_Set_Expiration(t *testing.T) {
|
||||
func Test_Redis_Expiration(t *testing.T) {
|
||||
var (
|
||||
testStore = New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
exp = 1 * time.Second
|
||||
@@ -61,17 +77,20 @@ func Test_Redis_Set_Expiration(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
time.Sleep(1100 * time.Millisecond)
|
||||
}
|
||||
|
||||
func Test_Redis_Get_Expired(t *testing.T) {
|
||||
key := "john"
|
||||
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Redis_Get_NotExist(t *testing.T) {
|
||||
testStore := New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
result, err := testStore.Get("notexist")
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
@@ -79,6 +98,9 @@ func Test_Redis_Get_NotExist(t *testing.T) {
|
||||
|
||||
func Test_Redis_Delete(t *testing.T) {
|
||||
var (
|
||||
testStore = New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
@@ -92,9 +114,16 @@ func Test_Redis_Delete(t *testing.T) {
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Redis_Reset(t *testing.T) {
|
||||
testStore := New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
val := []byte("doe")
|
||||
|
||||
err := testStore.Set("john1", val, 0)
|
||||
@@ -103,6 +132,10 @@ func Test_Redis_Reset(t *testing.T) {
|
||||
err = testStore.Set("john2", val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, keys, 2)
|
||||
|
||||
err = testStore.Reset()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -113,13 +146,23 @@ func Test_Redis_Reset(t *testing.T) {
|
||||
result, err = testStore.Get("john2")
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
keys, err = testStore.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
}
|
||||
|
||||
func Test_Redis_Close(t *testing.T) {
|
||||
testStore := New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
require.Nil(t, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Redis_Conn(t *testing.T) {
|
||||
testStore := New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
require.True(t, testStore.Conn() != nil)
|
||||
}
|
||||
|
||||
@@ -184,6 +227,10 @@ func Test_Redis_Initalize_WithURL_TLS(t *testing.T) {
|
||||
err = testStoreUrl.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUrl.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUrl.Close())
|
||||
}
|
||||
|
||||
@@ -226,6 +273,10 @@ func Test_Redis_Initalize_WithURL_TLS_Verify(t *testing.T) {
|
||||
err = testStoreUrl.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUrl.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUrl.Close())
|
||||
}
|
||||
|
||||
@@ -249,6 +300,10 @@ func Test_Redis_Initalize_With_Secure_URL(t *testing.T) {
|
||||
err = testStoreUrl.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUrl.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUrl.Close())
|
||||
}
|
||||
|
||||
@@ -273,6 +328,10 @@ func Test_Redis_Universal_Addrs(t *testing.T) {
|
||||
err = testStoreUniversal.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUniversal.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUniversal.Close())
|
||||
}
|
||||
|
||||
@@ -299,6 +358,10 @@ func Test_Redis_Universal_With_URL_Undefined(t *testing.T) {
|
||||
err = testStoreUniversal.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUniversal.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUniversal.Close())
|
||||
}
|
||||
|
||||
@@ -325,6 +388,10 @@ func Test_Redis_Universal_With_URL_Defined(t *testing.T) {
|
||||
err = testStoreUniversal.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUniversal.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUniversal.Close())
|
||||
}
|
||||
|
||||
@@ -352,6 +419,10 @@ func Test_Redis_Universal_With_HostPort(t *testing.T) {
|
||||
err = testStoreUniversal.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUniversal.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUniversal.Close())
|
||||
}
|
||||
|
||||
@@ -380,6 +451,10 @@ func Test_Redis_Universal_With_HostPort_And_URL(t *testing.T) {
|
||||
err = testStoreUniversal.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUniversal.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUniversal.Close())
|
||||
}
|
||||
|
||||
@@ -410,10 +485,17 @@ func Test_Redis_Cluster(t *testing.T) {
|
||||
err = testStoreUniversal.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
keys, err := testStoreUniversal.Keys()
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, keys)
|
||||
|
||||
require.Nil(t, testStoreUniversal.Close())
|
||||
}
|
||||
|
||||
func Benchmark_Redis_Set(b *testing.B) {
|
||||
testStore := New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
@@ -426,6 +508,9 @@ func Benchmark_Redis_Set(b *testing.B) {
|
||||
}
|
||||
|
||||
func Benchmark_Redis_Get(b *testing.B) {
|
||||
testStore := New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
err := testStore.Set("john", []byte("doe"), 0)
|
||||
require.NoError(b, err)
|
||||
|
||||
@@ -440,6 +525,9 @@ func Benchmark_Redis_Get(b *testing.B) {
|
||||
}
|
||||
|
||||
func Benchmark_Redis_SetAndDelete(b *testing.B) {
|
||||
testStore := New(Config{
|
||||
Reset: true,
|
||||
})
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
|
@@ -4,7 +4,7 @@ go 1.20
|
||||
|
||||
require (
|
||||
github.com/gofiber/utils/v2 v2.0.0-beta.3
|
||||
github.com/redis/rueidis v1.0.19
|
||||
github.com/redis/rueidis v1.0.21
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
|
@@ -7,15 +7,15 @@ github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
|
||||
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
|
||||
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/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo=
|
||||
github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
|
||||
github.com/redis/rueidis v1.0.21 h1:5vd5672hdNLQ7vaHygiZWZVhSrQ239PepuX9lkgAano=
|
||||
github.com/redis/rueidis v1.0.21/go.mod h1:8EOzvsg3o5dUDitRj4vpsolUKkSIvFz88PeQnqwTVk0=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
38
s3/go.mod
38
s3/go.mod
@@ -3,29 +3,29 @@ module github.com/gofiber/storage/s3/v2
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.1
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.44
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.42
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.89
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.40.1
|
||||
github.com/aws/aws-sdk-go-v2 v1.22.1
|
||||
github.com/aws/aws-sdk-go-v2/config v1.22.0
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.15.1
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.13.1
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.37 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.15.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.1 // indirect
|
||||
github.com/aws/smithy-go v1.15.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 // indirect
|
||||
github.com/aws/smithy-go v1.16.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
|
77
s3/go.sum
77
s3/go.sum
@@ -1,46 +1,45 @@
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.1 h1:wjHYshtPpYOZm+/mu3NhVgRRc0baM6LJZOmxPZ5Cwzs=
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.1/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14 h1:Sc82v7tDQ/vdU1WtuSyzZ1I7y/68j//HJ6uozND1IDs=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14/go.mod h1:9NCTOURS8OpxvoAVHq79LK81/zC78hfRWFn+aL0SPcY=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.44 h1:U10NQ3OxiY0dGGozmVIENIDnCT0W432PWxk2VO8wGnY=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.44/go.mod h1:pHxnQBldd0heEdJmolLBk78D1Bf69YnKLY3LOpFImlU=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.42 h1:KMkjpZqcMOwtRHChVlHdNxTUUAC6NC/b58mRZDIdcRg=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.42/go.mod h1:7ltKclhvEB8305sBhrpls24HGxORl6qgnQqSJ314Uw8=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12 h1:3j5lrl9kVQrJ1BU4O0z7MQ8sa+UXdiLuo4j0V+odNI8=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12/go.mod h1:JbFpcHDBdsex1zpIKuVRorZSQiZEyc3MykNCcjgz174=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.89 h1:XPqSyw8SBSLMRrF9Oip6tQpivXWJLMn8sdRoAsUCQQA=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.89/go.mod h1:OkYwM7gYm9HieL6emYtkg7Pb7Jd8FFM5Pl5uAZ1h2jo=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42 h1:817VqVe6wvwE46xXy6YF5RywvjOX6U2zRQQ6IbQFK0s=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42/go.mod h1:oDfgXoBBmj+kXnqxDDnIDnC56QBosglKp8ftRCTxR+0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36 h1:7ZApaXzWbo8slc+W5TynuUlB4z66g44h7uqa3/d/BsY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36/go.mod h1:rwr4WnmFi3RJO0M4dxbJtgi9BPLMpVBMX1nUte5ha9U=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44 h1:quOJOqlbSfeJTboXLjYXM1M9T52LBXqLoTPlmsKLpBo=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44/go.mod h1:LNy+P1+1LiRcCsVYr/4zG5n8zWFL0xsvZkOybjbftm8=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.5 h1:8JG9ny0BqBDzmtIzbpaN+eke152ZNsYKApFJ/q29Hxo=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.5/go.mod h1:kEDHQApP/ukMO9natNftgUN3NaTsMxK6jb2jjpSMX7Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15 h1:7R8uRYyXzdD71KWVCL78lJZltah6VVznXBazvKjfH58=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15/go.mod h1:26SQUPcTNgV1Tapwdt4a1rOsYRsnBsJHLMPoxK2b0d8=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.37 h1:Mx1zJlYbiUQANWT40koevLvxawGFolmkaP4m+LuyG7M=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.37/go.mod h1:PjKIAMFthKPgG/B8bbRpo3F8jfr2q2L+w3u78jJ12a0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36 h1:YXlm7LxwNlauqb2OrinWlcvtsflTzP8GaMvYfQBhoT4=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36/go.mod h1:ou9ffqJ9hKOVZmjlC6kQ6oROAyG1M4yBKzR+9BKbDwk=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.5 h1:sAAz28SeA7YZl8Yaphjs9tlLsflhdniQPjf3X2cqr4s=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.5/go.mod h1:HC7gNz3VH0p+RvLKK+HqNQv/gHy+1Os3ko/F41s3+aw=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.40.1 h1:FqIaVPbs2W8U3fszl2PCL1IDKeRdM7TssjWamL6b2mg=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.40.1/go.mod h1:X0e0NCAx4GjOrKro7s9QYy+YEIFhgCkt6gYKVKhZB5Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.15.1 h1:ZN3bxw9OYC5D6umLw6f57rNJfGfhg1DIAAcKpzyUTOE=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.15.1/go.mod h1:PieckvBoT5HtyB9AsJRrYZFY2Z+EyfVM/9zG6gbV8DQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2 h1:fSCCJuT5i6ht8TqGdZc5Q5K9pz/atrf7qH4iK5C9XzU=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2/go.mod h1:5eNtr+vNc5vVd92q7SJ+U/HszsIdhZBEyi9dkMRKsp8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.1 h1:ASNYk1ypWAxRhJjKS0jBnTUeDl7HROOpeSMu1xDA/I8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.1/go.mod h1:2cnsAhVT3mqusovc2stUSUrSBGTcX9nh8Tu6xh//2eI=
|
||||
github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8=
|
||||
github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
|
||||
github.com/aws/aws-sdk-go-v2 v1.22.1 h1:sjnni/AuoTXxHitsIdT0FwmqUuNUuHtufcVDErVFT9U=
|
||||
github.com/aws/aws-sdk-go-v2 v1.22.1/go.mod h1:Kd0OJtkW3Q0M0lUWGszapWjEvrXDzRW+D21JNsroB+c=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0 h1:hHgLiIrTRtddC0AKcJr5s7i/hLgcpTt+q/FKxf1Zayk=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0/go.mod h1:w4I/v3NOWgD+qvs1NPEwhd++1h3XPHFaVxasfY6HlYQ=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.22.0 h1:9Mm99OalzZRz0ab5fpodMoHBApHS6pqRNp3M9NmzvDg=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.22.0/go.mod h1:2eWgw5lps8fKI7LZVTrRTYP6HE6k/uEFUuTSHfXwqP0=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.15.1 h1:hmf6lAm9hk7uLCfapZn/jL05lm6Uwdbn1B0fgjyuf4M=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.15.1/go.mod h1:QTcHga3ZbQOneJuxmGBOCxiClxmp+TlvmjFexAnJ790=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2 h1:gIeH4+o1MN/caGBWjoGQTUTIu94xD6fI5B2+TcwBf70=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2/go.mod h1:wLyMIo/zPOhQhPXTddpfdkSleyigtFi8iMnC+2m/SK4=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.13.1 h1:ULswbgGNVrW8zEhkCNwrwXrs1mUvy2JTqWaCRsD2ZZw=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.13.1/go.mod h1:pAXgsDPk1rRwwfkz8/9ISO75vXEHqTGIgbLhGqqQ1GY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1 h1:fi1ga6WysOyYb5PAf3Exd6B5GiSNpnZim4h1rhlBqx0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1/go.mod h1:V5CY8wNurvPUibTi9mwqUqpiFZ5LnioKWIFUDtIzdI8=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1 h1:ZpaV/j48RlPc4AmOZuPv22pJliXjXq8/reL63YzyFnw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1/go.mod h1:R8aXraabD2e3qv1csxM14/X9WF4wFMIY0kH4YEtYD5M=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0 h1:DqOQvIfmGkXZUVJnl9VRk0AnxyS59tCtX9k1Pyss4Ak=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0/go.mod h1:VV/Kbw9Mg1GWJOT9WK+oTL3cWZiXtapnNvDSRqTZLsg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1 h1:vzYLDkwTw4CY0vUk84MeSufRf8XIsC/GsoIFXD60sTg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1/go.mod h1:ToBFBnjeGR2ruMx8IWp/y7vSK3Irj5/oPwifruiqoOM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0 h1:CJxo7ZBbaIzmXfV3hjcx36n9V87gJsIUPJflwqEHl3Q=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0/go.mod h1:yjVfjuY4nD1EW9i387Kau+I6V5cBA5YnC/mWNopjZrI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1 h1:15FUCJzAP9Y25nioTqTrGlZmhOtthaXBWlt4pS+d3Xo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1/go.mod h1:5655NW53Un6l7JzkI6AA3rZvf0m532cSnLThA1fVXcA=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1 h1:2OXw3ppu1XsB6rqKEMV4tnecTjIY3PRV2U6IP6KPJQo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1/go.mod h1:FZB4AdakIqW/yERVdGJA6Z9jraax1beXfhBBnK2wwR8=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1 h1:dnl0klXYX9EKpzZbWlH5LJL+YTcEZcJEMPFFr/rAHUQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1/go.mod h1:Mfk/9Joso4tCQYzM4q4HRUIqwln8lnIIMB/OE8Zebdc=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0 h1:u0YoSrxjr3Lm+IqIlRAV+4YTFwkXjyB9db9CfUFge2w=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0/go.mod h1:98EIdRu+BNsdqITsXfy+57TZfwlUQC9aDn9a9qoo90U=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 h1:I/Oh3IxGPfHXiGnwM54TD6hNr/8TlUrBXAtTyGhR+zw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.17.0/go.mod h1:H6NCMvDBqA+CvIaXzaSqM6LWtzv9BzZrqBOqz+PzRF8=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 h1:irbXQkfVYIRaewYSXcu4yVk0m2T+JzZd0dkop7FjmO0=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0/go.mod h1:4wPNCkM22+oRe71oydP66K50ojDUC33XutSMi2pEF/M=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 h1:sYIFy8tm1xQwRvVQ4CRuBGXKIg9sHNuG6+3UAQuoujk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0/go.mod h1:S/LOQUeYDfJeJpFCIJDMjy7dwL4aA33HUdVi+i7uH8k=
|
||||
github.com/aws/smithy-go v1.16.0 h1:gJZEH/Fqh+RsvlJ1Zt4tVAtV6bKkp3cC+R6FCZMNzik=
|
||||
github.com/aws/smithy-go v1.16.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
|
||||
|
183
scylladb/README.md
Normal file
183
scylladb/README.md
Normal file
@@ -0,0 +1,183 @@
|
||||
---
|
||||
id: scylladb
|
||||
title: ScyllaDb
|
||||
---
|
||||
|
||||

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

|
||||

|
||||

|
||||
|
||||
# ScyllaDb
|
||||
|
||||
A ScyllaDb storage engine for [Fiber](github.com/gofiber/fiber) using [gocql](github.com/scylladb/gocql).
|
||||
|
||||
### Table of Contents
|
||||
- [Signatures](#signatures)
|
||||
- [Installation](#installation)
|
||||
- [Examples](#examples)
|
||||
- [Config](#config)
|
||||
- [Default Config](#default-config)
|
||||
|
||||
### Signatures
|
||||
```go
|
||||
func New(config ...Config) Storage
|
||||
func (s *Storage) Get(key string) ([]byte, error)
|
||||
func (s *Storage) Set(key string, value []byte, expire time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *gocql.Session
|
||||
```
|
||||
|
||||
### Installation
|
||||
ScyllaDb 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 scylladb implementation:
|
||||
```bash
|
||||
go get github.com/gofiber/storage/scylladb
|
||||
```
|
||||
|
||||
### Examples
|
||||
Import the storage package.
|
||||
```go
|
||||
import "github.com/gofiber/storage/scylladb"
|
||||
```
|
||||
|
||||
You can use the following possibilities to create a storage:
|
||||
```go
|
||||
// Initialize default config
|
||||
store := scylladb.New()
|
||||
|
||||
// Initialize custom config
|
||||
store := scylladb.New(scylladb.Config{
|
||||
Keyspace: "fiber",
|
||||
Hosts: []string{"127.0.0.1"},
|
||||
Port: 9042,
|
||||
Table: "fiber_storage",
|
||||
Consistency: "ONE",
|
||||
Reset: false,
|
||||
})
|
||||
|
||||
// Initialize with support for TLS (SslOptions configures TLS use)
|
||||
//
|
||||
// InsecureSkipVerify and EnableHostVerification interact as follows:
|
||||
//
|
||||
// |Config.InsecureSkipVerify | EnableHostVerification | Result |
|
||||
// |--------------------------|------------------------|--------------------|
|
||||
// |Config is nil | false | do not verify host |
|
||||
// |Config is nil | true | verify host |
|
||||
// |false | false | verify host |
|
||||
// |true | false | do not verify host |
|
||||
// |false | true | verify host |
|
||||
// |true | true | verify host |
|
||||
store := New(
|
||||
Config{
|
||||
Keyspace: "fiber",
|
||||
Hosts: []string{"127.0.0.1"},
|
||||
Port: 9042,
|
||||
Table: "fiber_storage",
|
||||
Consistency: "ONE",
|
||||
SslOpts: &gocql.SslOptions{
|
||||
Config: &tls.Config{
|
||||
InsecureSkipVerify: false, // Set this too false to enable certificate verification
|
||||
},
|
||||
CertPath: "/path/to/client_cert.pem", // Path to the client certificate
|
||||
KeyPath: "/path/to/client_key.pem", // Path to the client certificate's private key
|
||||
CaPath: "/path/to/ca_cert.pem", // Path to the CA certificate
|
||||
EnableHostVerification: true, // Enable hostname verification
|
||||
},
|
||||
Reset: false,
|
||||
},
|
||||
)
|
||||
|
||||
// Initialize custom config using scylladb connection
|
||||
cluster, _ := gocql.NewCluster("127.0.0.1")
|
||||
cluster.Keyspace = "fiber"
|
||||
cluster.Port = 9042
|
||||
|
||||
session, _ := cluster.CreateSession()
|
||||
store := scylladb.New(scylladb.Config{
|
||||
Session: session,
|
||||
Keyspace: "fiber",
|
||||
Table: "fiber_storage",
|
||||
Reset: false,
|
||||
})
|
||||
```
|
||||
|
||||
### Config
|
||||
```go
|
||||
type Config struct {
|
||||
// Session is provided by the user to use an existing ScyllaDb session
|
||||
// Session Will override Keyspace and all other authentication values if used
|
||||
//
|
||||
// Optional. Default is nil
|
||||
Session *gocql.Session
|
||||
|
||||
// Keyspace name
|
||||
//
|
||||
// Optional. Default is "fiber"
|
||||
Keyspace string
|
||||
|
||||
// Hosts are an array of network addresses for establishing initial connections
|
||||
// You have the flexibility to specify one or multiple addresses as needed
|
||||
//
|
||||
// Optional. Default is "127.0.0.1"
|
||||
Hosts []string
|
||||
|
||||
// Port where the ScyllaDb cluster is listening on
|
||||
//
|
||||
// Optional. Default is 9042
|
||||
Port int
|
||||
|
||||
// Username for ScyllaDb cluster
|
||||
//
|
||||
// Optional. Default is ""
|
||||
Username string
|
||||
|
||||
// Password for ScyllaDb cluster
|
||||
//
|
||||
// Optional. Default is ""
|
||||
Password string
|
||||
|
||||
// Table name
|
||||
//
|
||||
// Optional. Default is "fiber_storage"
|
||||
Table string
|
||||
|
||||
// Level of the consistency
|
||||
//
|
||||
// Optional. Default is "LOCAL_ONE"
|
||||
Consistency string
|
||||
|
||||
// SslOpts configures TLS use.
|
||||
//
|
||||
// Optional. Default is nil
|
||||
SslOpts *gocql.SslOptions
|
||||
|
||||
// Reset clears any existing keys in existing Table
|
||||
//
|
||||
// Optional. Default is false
|
||||
Reset bool
|
||||
}
|
||||
```
|
||||
|
||||
### Default Config
|
||||
```go
|
||||
// ConfigDefault is the default config
|
||||
var ConfigDefault = Config{
|
||||
Session: nil,
|
||||
Keyspace: "fiber",
|
||||
Hosts: []string{"127.0.0.1"},
|
||||
Username: "",
|
||||
Password: "",
|
||||
Port: 9042,
|
||||
Table: "fiber_storage",
|
||||
Consistency: "LOCAL_ONE",
|
||||
SslOpts: nil,
|
||||
Reset: false,
|
||||
}
|
||||
```
|
102
scylladb/config.go
Normal file
102
scylladb/config.go
Normal file
@@ -0,0 +1,102 @@
|
||||
package scylladb
|
||||
|
||||
import (
|
||||
"github.com/gocql/gocql"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
// Session is provided by the user to use an existing ScyllaDb session
|
||||
//
|
||||
// Optional. Default is nil
|
||||
Session *gocql.Session
|
||||
|
||||
// Keyspace name
|
||||
//
|
||||
// Optional. Default is "fiber"
|
||||
Keyspace string
|
||||
|
||||
// Hosts are an array of network addresses for establishing initial connections.
|
||||
// You have the flexibility to specify one or multiple addresses as needed.
|
||||
//
|
||||
// Optional. Default is "127.0.0.1"
|
||||
Hosts []string
|
||||
|
||||
// Port where the ScyllaDb cluster is listening on
|
||||
//
|
||||
// Optional. Default is 9042
|
||||
Port int
|
||||
|
||||
// Username for ScyllaDb cluster
|
||||
//
|
||||
// Optional. Default is ""
|
||||
Username string
|
||||
|
||||
// Password for ScyllaDb cluster
|
||||
//
|
||||
// Optional. Default is ""
|
||||
Password string
|
||||
|
||||
// Table name
|
||||
//
|
||||
// Optional. Default is "fiber_storage"
|
||||
Table string
|
||||
|
||||
// Level of the consistency
|
||||
//
|
||||
// Optional. Default is "LOCAL_ONE"
|
||||
Consistency string
|
||||
|
||||
// SslOpts configures TLS use.
|
||||
//
|
||||
// Optional. Default is nil
|
||||
SslOpts *gocql.SslOptions
|
||||
|
||||
// Reset clears any existing keys in existing Table
|
||||
//
|
||||
// Optional. Default is false
|
||||
Reset bool
|
||||
}
|
||||
|
||||
// ConfigDefault is the default config
|
||||
var ConfigDefault = Config{
|
||||
Session: nil,
|
||||
Keyspace: "fiber",
|
||||
Hosts: []string{"127.0.0.1"},
|
||||
Username: "",
|
||||
Password: "",
|
||||
Port: 9042,
|
||||
Table: "fiber_storage",
|
||||
Consistency: "LOCAL_ONE",
|
||||
SslOpts: nil,
|
||||
Reset: false,
|
||||
}
|
||||
|
||||
// configDefault helps to set a default config
|
||||
func configDefault(config ...Config) Config {
|
||||
// Return default config if nothing provided
|
||||
if len(config) < 1 {
|
||||
return ConfigDefault
|
||||
}
|
||||
|
||||
// Override default config
|
||||
cfg := config[0]
|
||||
|
||||
// Set default values
|
||||
if cfg.Hosts == nil {
|
||||
cfg.Hosts = ConfigDefault.Hosts
|
||||
}
|
||||
if cfg.Port <= 0 {
|
||||
cfg.Port = ConfigDefault.Port
|
||||
}
|
||||
if len(strings.TrimSpace(cfg.Table)) == 0 {
|
||||
cfg.Table = ConfigDefault.Table
|
||||
}
|
||||
if len(strings.TrimSpace(cfg.Keyspace)) == 0 {
|
||||
cfg.Keyspace = ConfigDefault.Keyspace
|
||||
}
|
||||
if len(strings.TrimSpace(cfg.Consistency)) == 0 {
|
||||
cfg.Consistency = ConfigDefault.Consistency
|
||||
}
|
||||
return cfg
|
||||
}
|
19
scylladb/go.mod
Normal file
19
scylladb/go.mod
Normal file
@@ -0,0 +1,19 @@
|
||||
module github.com/gofiber/storage/scylladb
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/gocql/gocql v1.6.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace github.com/gocql/gocql => github.com/scylladb/gocql v1.11.1
|
45
scylladb/go.sum
Normal file
45
scylladb/go.sum
Normal file
@@ -0,0 +1,45 @@
|
||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY=
|
||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
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/scylladb/gocql v1.11.1 h1:AlIPHHZf2l0Cbj8wGjfELspaGfnd4meGj9sPQnr5dn8=
|
||||
github.com/scylladb/gocql v1.11.1/go.mod h1:ZLEJ0EVE5JhmtxIW2stgHq/v1P4fWap0qyyXSKyV8K0=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
golang.org/x/net v0.0.0-20220526153639-5463443f8c37 h1:lUkvobShwKsOesNfWWlCS5q7fnbG1MEliIzwu886fn8=
|
||||
golang.org/x/net v0.0.0-20220526153639-5463443f8c37/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
175
scylladb/scylladb.go
Normal file
175
scylladb/scylladb.go
Normal file
@@ -0,0 +1,175 @@
|
||||
package scylladb
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gocql/gocql"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Storage interface that is implemented by storage providers
|
||||
type Storage struct {
|
||||
session *gocql.Session
|
||||
tableName string
|
||||
|
||||
selectQuery string
|
||||
insertQuery string
|
||||
deleteQuery string
|
||||
resetQuery string
|
||||
}
|
||||
|
||||
var (
|
||||
checkSchemaErrorMsg = errors.New("the `value` row has an incorrect data type. " +
|
||||
"The message should be BLOB, but it is instead %s. This could lead to encoding-related issues if the database is not migrated (refer to https://github.com/gofiber/storage/blob/main/MIGRATE.md)")
|
||||
keyspaceErrorMsg = errors.New(`keyspace cannot be empty`)
|
||||
createKeyspaceQuery = `CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};`
|
||||
dropQuery = `DROP TABLE IF EXISTS %s.%s;`
|
||||
createTableQuery = `CREATE TABLE IF NOT EXISTS %s.%s (key TEXT PRIMARY KEY, value BLOB)`
|
||||
checkSchemaQuery = `SELECT type FROM system_schema.columns WHERE keyspace_name = '%s' AND table_name = '%s' AND column_name = 'value';`
|
||||
selectQuery = `SELECT value FROM %s.%s WHERE key = ?`
|
||||
insertQuery = `INSERT INTO %s.%s (key, value) VALUES (?, ?) USING TTL ?`
|
||||
deleteQuery = `DELETE FROM %s.%s WHERE key = ?`
|
||||
resetQuery = `TRUNCATE %s.%s`
|
||||
)
|
||||
|
||||
// New creates a new storage
|
||||
func New(config ...Config) *Storage {
|
||||
var err error
|
||||
var session *gocql.Session
|
||||
|
||||
// Set default config
|
||||
cfg := configDefault(config...)
|
||||
|
||||
if len(strings.TrimSpace(cfg.Keyspace)) == 0 {
|
||||
panic(keyspaceErrorMsg)
|
||||
}
|
||||
|
||||
if cfg.Session == nil {
|
||||
// Create a new cluster
|
||||
cluster := gocql.NewCluster(cfg.Hosts...)
|
||||
cluster.Consistency = gocql.ParseConsistency(cfg.Consistency)
|
||||
cluster.Port = cfg.Port
|
||||
|
||||
// Set credentials if provided
|
||||
if len(strings.TrimSpace(cfg.Username)) > 0 && len(strings.TrimSpace(cfg.Password)) > 0 {
|
||||
cluster.Authenticator = gocql.PasswordAuthenticator{
|
||||
Username: cfg.Username,
|
||||
Password: cfg.Password,
|
||||
}
|
||||
}
|
||||
|
||||
// Set cfg.SslOpts if provided.
|
||||
if cfg.SslOpts != nil {
|
||||
cluster.SslOpts = cfg.SslOpts
|
||||
}
|
||||
|
||||
// Create session
|
||||
session, err = cluster.CreateSession()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
// Set session if provided
|
||||
session = cfg.Session
|
||||
}
|
||||
|
||||
// Create keyspace if it does not exist
|
||||
if err = session.Query(fmt.Sprintf(createKeyspaceQuery, cfg.Keyspace)).Exec(); err != nil {
|
||||
session.Close()
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Drop table if reset is true
|
||||
if cfg.Reset {
|
||||
if err = session.Query(fmt.Sprintf(dropQuery, cfg.Keyspace, cfg.Table)).Exec(); err != nil {
|
||||
session.Close()
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Create the storage
|
||||
store := &Storage{
|
||||
session: session,
|
||||
tableName: cfg.Table,
|
||||
selectQuery: fmt.Sprintf(selectQuery, cfg.Keyspace, cfg.Table),
|
||||
insertQuery: fmt.Sprintf(insertQuery, cfg.Keyspace, cfg.Table),
|
||||
deleteQuery: fmt.Sprintf(deleteQuery, cfg.Keyspace, cfg.Table),
|
||||
resetQuery: fmt.Sprintf(resetQuery, cfg.Keyspace, cfg.Table),
|
||||
}
|
||||
|
||||
// Create table if not exists
|
||||
if err = store.createTableIfNotExists(cfg.Keyspace); err != nil {
|
||||
session.Close()
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Check schema
|
||||
store.checkSchema(cfg.Keyspace)
|
||||
|
||||
return store // Return storage
|
||||
}
|
||||
|
||||
func (s *Storage) createTableIfNotExists(keyspace string) error {
|
||||
// Create table if not exists
|
||||
query := fmt.Sprintf(createTableQuery, keyspace, s.tableName)
|
||||
if err := s.session.Query(query).Exec(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Storage) checkSchema(keyspace string) {
|
||||
// Check schema for value column type (should be blob)
|
||||
var dataType string
|
||||
query := fmt.Sprintf(checkSchemaQuery, keyspace, s.tableName)
|
||||
if err := s.session.Query(query).Scan(&dataType); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if dataType != "blob" {
|
||||
panic(fmt.Errorf(checkSchemaErrorMsg.Error(), dataType))
|
||||
}
|
||||
}
|
||||
|
||||
// Get retrieves a value by key
|
||||
func (s *Storage) Get(key string) ([]byte, error) {
|
||||
var value []byte
|
||||
if err := s.session.Query(s.selectQuery, key).Scan(&value); err != nil {
|
||||
if errors.Is(err, gocql.ErrNotFound) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return value, nil
|
||||
}
|
||||
|
||||
// Set sets a value by key
|
||||
func (s *Storage) Set(key string, value []byte, expire time.Duration) error {
|
||||
var expiration int
|
||||
if expire != 0 {
|
||||
expiration = int(expire.Round(time.Second).Seconds())
|
||||
}
|
||||
return s.session.Query(s.insertQuery, key, value, expiration).Exec()
|
||||
}
|
||||
|
||||
// Delete removes a value by key
|
||||
func (s *Storage) Delete(key string) error {
|
||||
return s.session.Query(s.deleteQuery, key).Exec()
|
||||
}
|
||||
|
||||
// Reset resets all values
|
||||
func (s *Storage) Reset() error {
|
||||
return s.session.Query(s.resetQuery).Exec()
|
||||
}
|
||||
|
||||
// Close closes the storage
|
||||
func (s *Storage) Close() error {
|
||||
s.session.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Conn returns the underlying gocql session
|
||||
func (s *Storage) Conn() *gocql.Session {
|
||||
return s.session
|
||||
}
|
164
scylladb/scylladb_test.go
Normal file
164
scylladb/scylladb_test.go
Normal file
@@ -0,0 +1,164 @@
|
||||
package scylladb
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
var testStore = New(Config{Reset: true})
|
||||
|
||||
func Test_Scylla_Set(t *testing.T) {
|
||||
// Create a new instance of the Storage
|
||||
var (
|
||||
key = "john"
|
||||
value = []byte("doe")
|
||||
)
|
||||
err := testStore.Set(key, value, 0)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func Test_Scylla_Set_Override_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
valInitial = []byte("doe")
|
||||
valOverride = []byte("doe2")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, valInitial, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, valInitial, result)
|
||||
|
||||
err = testStore.Set(key, valOverride, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err = testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, valOverride, result)
|
||||
}
|
||||
|
||||
func Test_Scylla_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, val, result)
|
||||
}
|
||||
|
||||
func Test_Scylla_Set_Expiration_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
exp = 1 * time.Second
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, exp)
|
||||
require.NoError(t, err)
|
||||
|
||||
time.Sleep(1001 * time.Millisecond)
|
||||
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, result)
|
||||
}
|
||||
|
||||
func Test_Scylla_Get_NotExist(t *testing.T) {
|
||||
|
||||
result, err := testStore.Get("not-exist")
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
}
|
||||
|
||||
func Test_Scylla_Delete(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = testStore.Delete(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err := testStore.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
}
|
||||
|
||||
func Test_Scylla_Reset(t *testing.T) {
|
||||
var val = []byte("doe")
|
||||
|
||||
err := testStore.Set("john1", val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = testStore.Set("john2", val, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = testStore.Reset()
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err := testStore.Get("john1")
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
|
||||
result, err = testStore.Get("john2")
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, len(result))
|
||||
}
|
||||
|
||||
func Test_Scylla_Close(t *testing.T) {
|
||||
require.Nil(t, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Scylla_Conn(t *testing.T) {
|
||||
require.True(t, testStore.Conn() != nil)
|
||||
}
|
||||
|
||||
func Benchmark_Scylla_Set(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
var err error
|
||||
for i := 0; i < b.N; i++ {
|
||||
err = testStore.Set("john", []byte("doe"), 0)
|
||||
}
|
||||
|
||||
require.NoError(b, err)
|
||||
}
|
||||
|
||||
func Benchmark_Scylla_Get(b *testing.B) {
|
||||
err := testStore.Set("john", []byte("doe"), 0)
|
||||
require.NoError(b, err)
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err = testStore.Get("john")
|
||||
}
|
||||
|
||||
require.NoError(b, err)
|
||||
}
|
||||
|
||||
func Benchmark_Scylla_SetAndDelete(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
var err error
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = testStore.Set("john", []byte("doe"), 0)
|
||||
err = testStore.Delete("john")
|
||||
}
|
||||
|
||||
require.NoError(b, err)
|
||||
}
|
Reference in New Issue
Block a user