mirror of
https://github.com/gofiber/storage.git
synced 2025-09-27 21:02:20 +08:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
efffcc135b | ||
![]() |
1b233673bb | ||
![]() |
07bde5f757 | ||
![]() |
ce174aed64 | ||
![]() |
cff33471cf | ||
![]() |
e211b33874 | ||
![]() |
05c149e84f | ||
![]() |
bf50899345 | ||
![]() |
b2f8339751 | ||
![]() |
e0435cd1a0 | ||
![]() |
d03bf4584c | ||
![]() |
e40f7b86df | ||
![]() |
3a8b8d4f71 | ||
![]() |
c38c925975 | ||
![]() |
d27ddd4739 | ||
![]() |
0aec65bb77 | ||
![]() |
671a3e4a04 | ||
![]() |
cbc4d3d251 | ||
![]() |
fe8cc5f97c | ||
![]() |
af3630ee22 | ||
![]() |
602260698d | ||
![]() |
ad27e8bcbb | ||
![]() |
d4ddc46c29 | ||
![]() |
ac29a7e86c | ||
![]() |
daa2dc7ee4 | ||
![]() |
1e822400d5 | ||
![]() |
57f7bb86d5 | ||
![]() |
ba65508bc9 | ||
![]() |
30e23d86d0 | ||
![]() |
7c79c78623 | ||
![]() |
caf28d82f7 | ||
![]() |
28ae1f71fb |
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@@ -2,12 +2,12 @@
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
labels:
|
||||
- "🤖 Dependencies"
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
labels:
|
||||
- "🤖 Dependencies"
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/" # Location of package manifests
|
||||
labels:
|
||||
|
23
.github/workflows/dependabot_automerge.yml
vendored
Normal file
23
.github/workflows/dependabot_automerge.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Dependabot auto-merge
|
||||
on: pull_request
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
dependabot:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||
steps:
|
||||
- name: Dependabot metadata
|
||||
id: metadata
|
||||
uses: dependabot/fetch-metadata@v1.3.3
|
||||
with:
|
||||
github-token: "${{ secrets.PR_TOKEN }}"
|
||||
- name: Enable auto-merge for Dependabot PRs
|
||||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
|
||||
run: gh pr merge --auto --merge "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{github.event.pull_request.html_url}}
|
||||
GITHUB_TOKEN: ${{secrets.PR_TOKEN}}
|
@@ -57,6 +57,9 @@ type Storage interface {
|
||||
* [Badger](/badger) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Local+Storage%22">
|
||||
<img src="https://img.shields.io/github/workflow/status/gofiber/storage/Local%20Storage?label=%F0%9F%A7%AA%20&style=flat&color=75C46B">
|
||||
</a>
|
||||
* [Bbolt](/bbolt) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Bbolt%22">
|
||||
<img src="https://img.shields.io/github/workflow/status/gofiber/storage/Bbolt?label=%F0%9F%A7%AA%20&style=flat&color=75C46B">
|
||||
</a>
|
||||
* [DynamoDB](/dynamodb) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22DynamoDB%22">
|
||||
<img src="https://img.shields.io/github/workflow/status/gofiber/storage/DynamoDB?label=%F0%9F%A7%AA%20&style=flat&color=75C46B">
|
||||
</a>
|
||||
@@ -84,6 +87,3 @@ type Storage interface {
|
||||
* [S3](/s3) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22S3%22">
|
||||
<img src="https://img.shields.io/github/workflow/status/gofiber/storage/S3?label=%F0%9F%A7%AA%20&style=flat&color=75C46B">
|
||||
</a>
|
||||
* [Bbolt](/bbolt) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Bbolt%22">
|
||||
<img src="https://img.shields.io/github/workflow/status/gofiber/storage/Bbolt?label=%F0%9F%A7%AA%20&style=flat&color=75C46B">
|
||||
</a>
|
@@ -16,6 +16,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() driver.Client
|
||||
```
|
||||
### Installation
|
||||
ArangoDB is tested on the 2 last (1.14/1.15) [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:
|
||||
|
@@ -246,3 +246,8 @@ func (s *Storage) gc() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() driver.Client {
|
||||
return s.client
|
||||
}
|
||||
|
@@ -132,3 +132,7 @@ func Test_ARANGODB_Non_UTF8(t *testing.T) {
|
||||
func Test_ARANGODB_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_ARANGODB_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *badger.DB
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
@@ -123,3 +123,8 @@ func (s *Storage) gc() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *badger.DB {
|
||||
return s.db
|
||||
}
|
||||
|
@@ -119,3 +119,7 @@ func Test_Badger_Reset(t *testing.T) {
|
||||
func Test_Badger_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Badger_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
@@ -17,6 +17,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *bbolt.DB
|
||||
```
|
||||
### Installation
|
||||
Bbolt 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:
|
||||
|
@@ -104,3 +104,8 @@ func (s *Storage) Reset() error {
|
||||
func (s *Storage) Close() error {
|
||||
return s.conn.Close()
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *bbolt.DB {
|
||||
return s.conn
|
||||
}
|
||||
|
@@ -95,3 +95,7 @@ func Test_Bbolt_Reset(t *testing.T) {
|
||||
func Test_Bbolt_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Bbolt_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *awsdynamodb.Client
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
@@ -264,3 +264,8 @@ func returnAWSConfig(cfg Config) (aws.Config, error) {
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *awsdynamodb.Client {
|
||||
return s.db
|
||||
}
|
||||
|
@@ -105,3 +105,7 @@ func Test_DynamoDB_Reset(t *testing.T) {
|
||||
func Test_DynamoDB_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_DynamoDB_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -3,10 +3,10 @@ module github.com/gofiber/storage/dynamodb
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.8
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.15
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.10
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.9.8
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.15.10
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.11
|
||||
github.com/aws/aws-sdk-go-v2/config v1.17.1
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.14
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.9.12
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.16.0
|
||||
github.com/gofiber/utils v0.1.2
|
||||
)
|
||||
|
@@ -1,35 +1,35 @@
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.8 h1:gOe9UPR98XSf7oEJCcojYg+N2/jCRm4DdeIsP85pIyQ=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.8/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.15 h1:yBV+J7Au5KZwOIrIYhYkTGJbifZPCkAnCFSvGsF3ui8=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.15/go.mod h1:A1Lzyy/o21I5/s2FbyX5AevQfSVXpvvIDCoVFD0BC4E=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.10 h1:7gGcMQePejwiKoDWjB9cWnpfVdnz/e5JwJFuT6OrroI=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.10/go.mod h1:g5eIM5XRs/OzIIK81QMBl+dAuDyoLN0VYaLP+tBqEOk=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.9.8 h1:0ip7KxkhaxsDsxOGHl8/6PRzuvkBnNCKQQNXCrmBRA4=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.9.8/go.mod h1:gYOUOID0SE7Sc7b/5TocldT6Veh7Hftd0RgszK0B9kg=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9 h1:hz8tc+OW17YqxyFFPSkvfSikbqWcyyHRyPVSTzC0+aI=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9/go.mod h1:KDCCm4ONIdHtUloDcFvK2+vshZvx4Zmj7UMDfusuz5s=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15 h1:bx5F2mr6H6FC7zNIQoDoUr8wEKnvmwRncujT3FYRtic=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15/go.mod h1:pWrr2OoHlT7M/Pd2y4HV3gJyPb3qj5qMmnPkKSNPYK4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9 h1:5sbyznZC2TeFpa4fvtpvpcGbzeXEEs1l1Jo51ynUNsQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9/go.mod h1:08tUpeSGN33QKSO7fwxXczNfiwCpbj+GxK6XKwqWVv0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16 h1:f0ySVcmQhwmzn7zQozd8wBM3yuGBfzdpsOaKQ0/Epzw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16/go.mod h1:CYmI+7x03jjJih8kBEEFKRQc40UjUokT0k7GbvrhhTc=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.15.10 h1:GLklbtMUQCToju09LyT+AjbwTQ0KCQudNLTA0H2xbBk=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.15.10/go.mod h1:zM5dQf0mZfcW4s8OsJFXvzedbY5n1rO581X4xei6XcA=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.13.11 h1:ZhmeOIq1SIn2QRYbVX1RC+k2+V3o/Cb6Rb8l4NNs8sA=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.13.11/go.mod h1:SfaTqHKnCntSSFP9xjozom2kJVhNF4s9cxWdmMoc8Bo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3 h1:4n4KCtv5SUoT5Er5XV41huuzrCqepxlW3SDI9qHQebc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3/go.mod h1:gkb2qADY+OHaGLKNTYxMaQNacfeyQpZ4csDTQMeFmcw=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.9 h1:COsLtfmOSgPGnKUreE99/5pIgtmGLzmLtVrQa12QzU4=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.9/go.mod h1:IixPDVckNk0HhYDQwUmTonTAfQlfABg9E72whAbq5k0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9 h1:sHfDuhbOuuWSIAEDd3pma6p0JgUcR2iePxtCE8gfCxQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9/go.mod h1:yQowTpvdZkFVuHrLBXmczat4W+WJKg/PafBZnGBLga0=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.13 h1:DQpf+al+aWozOEmVEdml67qkVZ6vdtGUi71BZZWw40k=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.13/go.mod h1:d7ptRksDDgvXaUvxyHZ9SYh+iMDymm94JbVcgvSYSzU=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.10 h1:7tquJrhjYz2EsCBvA9VTl+sBAAh1bv7h/sGASdZOGGo=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.10/go.mod h1:cftkHYN6tCDNfkSasAmclSfl4l7cySoay8vz7p/ce0E=
|
||||
github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0=
|
||||
github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdbC0YQ=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.17.1 h1:BWxTjokU/69BZ4DnLrZco6OvBDii6ToEdfBL/y5I1nA=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.17.1/go.mod h1:uOxDHjBemNTF2Zos+fgG0NNfE86wn1OAHDTGxjMEYi0=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.14 h1:AtVG/amkjbDBfnPr/tuW2IG18HGNznP6L12Dx0rLz+Q=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.14/go.mod h1:opAndTyq+YN7IpVG57z2CeNuXSQMqTYxGGlYH0m0RMY=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.9.12 h1:/xDoFLYZvquMyHb1RXlV39AFeBe2tL+fvukC73N83+Q=
|
||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.9.12/go.mod h1:RhKTuOT6Fno/LayisE+mikyYMX1vhA86sw5ml/qaAQ4=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 h1:wgJBHO58Pc1V1QAnzdVM3JK3WbE/6eUF0JxCZ+/izz0=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 h1:OmiwoVyLKEqqD5GvB683dbSqxiOfvx4U2lDZhG2Esc4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18/go.mod h1:348MLhzV1GSlZSMusdwQpXKbhD7X2gbI/TxwAPKkYZQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 h1:5mvQDtNWtI6H56+E4LUnLWEmATMB7oEh+Z9RurtIuC0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12/go.mod h1:ckaCVTEdGAxO6KwTGzgskxR1xM+iJW4lxMyDFVda2Fc=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 h1:g5qq9sgtEzt2szMaDqQO6fqKe026T6dHTFJp5NsPzkQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19/go.mod h1:cVHo8KTuHjShb9V8/VjH3S/8+xPu16qx8fdGwmotJhE=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.16.0 h1:ksj63LdkxB0PbZS2yv5o1aKlZmsBXjHgzeD3UGo2iR4=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.16.0/go.mod h1:nDZhoTDS8glO/h5JZEfa9wIvgynUTVUCOJQCuChvQH8=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.13.14 h1:Gz6uNxPZAb2V4s/UgLP/DLYx/0XIuqXJOuhJOW3Er84=
|
||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.13.14/go.mod h1:6D35RzbuPTePdKDN2B9qGaABNM06g6VHRjBsRHJQONs=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.5 h1:g1ITJ9i9ixa+/WVggLNK20KyliAA8ltnuxfZEDfo2hM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.5/go.mod h1:oehQLbMQkppKLXvpx/1Eo0X47Fe+0971DXC9UjGnKcI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.12 h1:yFvvaM+8B3HQzrG74t6fGDQtcKS83sL2PqOG6VCd3kE=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.12/go.mod h1:kYafXnLWK/6IHBRzbQ3HI7Py1ayiYEdb8hxNI9fNpO4=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 h1:7iPTTX4SAI2U2VOogD7/gmHlsgnYSgoNHt7MSQXtG2M=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.17 h1:pXxu9u2z1UqSbjO9YA8kmFJBhFc1EVTDaf7A+S+Ivq8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.17/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 h1:dl8T0PJlN92rvEGOEUiD0+YPYdPEaCZK0TqHukvSfII=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0=
|
||||
github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag=
|
||||
github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gofiber/utils v0.1.2 h1:1SH2YEz4RlNS0tJlMJ0bGwO0JkqPqvq6TbHK9tXZKtk=
|
||||
|
@@ -17,6 +17,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *mc.Client
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
@@ -122,3 +122,8 @@ func (s *Storage) releaseItem(item *mc.Item) {
|
||||
s.items.Put(item)
|
||||
}
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *mc.Client {
|
||||
return s.db
|
||||
}
|
||||
|
@@ -119,3 +119,7 @@ func Test_Memcache_Reset(t *testing.T) {
|
||||
func Test_Memcache_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Memcache_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() map[string]entry
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
@@ -116,3 +116,8 @@ func (s *Storage) gc() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() map[string]entry {
|
||||
return s.db
|
||||
}
|
||||
|
@@ -119,3 +119,7 @@ func Test_Memory_Reset(t *testing.T) {
|
||||
func Test_Memory_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Memory_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
@@ -17,6 +17,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *mongo.Database
|
||||
```
|
||||
### Installation
|
||||
MongoDB 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:
|
||||
|
@@ -199,3 +199,8 @@ func (s *Storage) releaseItem(item *item) {
|
||||
s.items.Put(item)
|
||||
}
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *mongo.Database {
|
||||
return s.db
|
||||
}
|
||||
|
@@ -121,3 +121,7 @@ func Test_MongoDB_Reset(t *testing.T) {
|
||||
func Test_MongoDB_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_MongoDB_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *sql.DB
|
||||
```
|
||||
### Installation
|
||||
MySQL 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:
|
||||
@@ -48,11 +49,23 @@ store := mysql.New(mysql.Config{
|
||||
Reset: false,
|
||||
GCInterval: 10 * time.Second,
|
||||
})
|
||||
|
||||
// Initialize custom config using connection string
|
||||
store := postgres.New(postgres.Config{
|
||||
ConnectionURI: "mysql://user:password@localhost:3306/fiber"
|
||||
Reset: false,
|
||||
GCInterval: 10 * time.Second,
|
||||
})
|
||||
```
|
||||
|
||||
### Config
|
||||
```go
|
||||
type Config struct {
|
||||
// Connection string to use for DB. Will override all other authentication values if used
|
||||
//
|
||||
// Optional. Default is ""
|
||||
ConnectionURI string
|
||||
|
||||
// Host name where the DB is hosted
|
||||
//
|
||||
// Optional. Default is "127.0.0.1"
|
||||
@@ -98,6 +111,7 @@ type Config struct {
|
||||
### Default Config
|
||||
```go
|
||||
var ConfigDefault = Config{
|
||||
ConnectionURI: "",
|
||||
Host: "127.0.0.1",
|
||||
Port: 3306,
|
||||
Database: "fiber",
|
||||
|
@@ -7,6 +7,11 @@ import (
|
||||
|
||||
// Config defines the config for storage.
|
||||
type Config struct {
|
||||
// Connection string to use for DB. Will override all other authentication values if used
|
||||
//
|
||||
// Optional. Default is ""
|
||||
ConnectionURI string
|
||||
|
||||
// Host name where the DB is hosted
|
||||
//
|
||||
// Optional. Default is "127.0.0.1"
|
||||
@@ -58,6 +63,7 @@ type Config struct {
|
||||
|
||||
// ConfigDefault is the default config
|
||||
var ConfigDefault = Config{
|
||||
ConnectionURI: "",
|
||||
Host: "127.0.0.1",
|
||||
Port: 3306,
|
||||
Database: "fiber",
|
||||
@@ -70,6 +76,9 @@ var ConfigDefault = Config{
|
||||
}
|
||||
|
||||
func (c Config) dsn() string {
|
||||
if c.ConnectionURI != "" {
|
||||
return c.ConnectionURI
|
||||
}
|
||||
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s", c.Username, c.Password, c.Host, c.Port, c.Database)
|
||||
}
|
||||
|
||||
|
@@ -165,6 +165,11 @@ func (s *Storage) Close() error {
|
||||
return s.db.Close()
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *sql.DB {
|
||||
return s.db
|
||||
}
|
||||
|
||||
// gcTicker starts the gc ticker
|
||||
func (s *Storage) gcTicker() {
|
||||
ticker := time.NewTicker(s.gcInterval)
|
||||
|
@@ -162,3 +162,7 @@ func Test_MYSQL_Non_UTF8(t *testing.T) {
|
||||
func Test_MYSQL_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_MYSQL_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *sql.DB
|
||||
```
|
||||
### Installation
|
||||
Postgres 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:
|
||||
@@ -49,12 +50,24 @@ store := postgres.New(postgres.Config{
|
||||
GCInterval: 10 * time.Second,
|
||||
SslMode: "disable",
|
||||
})
|
||||
|
||||
// Initialize custom config using connection string
|
||||
store := postgres.New(postgres.Config{
|
||||
ConnectionURI: "postgresql://user:password@localhost:5432/fiber"
|
||||
Reset: false,
|
||||
GCInterval: 10 * time.Second,
|
||||
})
|
||||
```
|
||||
|
||||
### Config
|
||||
```go
|
||||
// Config defines the config for storage.
|
||||
type Config struct {
|
||||
// Connection string to use for DB. Will override all other authentication values if used
|
||||
//
|
||||
// Optional. Default is ""
|
||||
ConnectionURI string
|
||||
|
||||
// Host name where the DB is hosted
|
||||
//
|
||||
// Optional. Default is "127.0.0.1"
|
||||
@@ -105,6 +118,7 @@ type Config struct {
|
||||
### Default Config
|
||||
```go
|
||||
var ConfigDefault = Config{
|
||||
ConnectionURI: "",
|
||||
Host: "127.0.0.1",
|
||||
Port: 5432,
|
||||
Database: "fiber",
|
||||
|
@@ -6,6 +6,11 @@ import (
|
||||
|
||||
// Config defines the config for storage.
|
||||
type Config struct {
|
||||
// Connection string to use for DB. Will override all other authentication values if used
|
||||
//
|
||||
// Optional. Default is ""
|
||||
ConnectionURI string
|
||||
|
||||
// Host name where the DB is hosted
|
||||
//
|
||||
// Optional. Default is "127.0.0.1"
|
||||
@@ -90,6 +95,7 @@ type Config struct {
|
||||
|
||||
// ConfigDefault is the default config
|
||||
var ConfigDefault = Config{
|
||||
ConnectionURI: "",
|
||||
Host: "127.0.0.1",
|
||||
Port: 5432,
|
||||
Database: "fiber",
|
||||
|
@@ -46,26 +46,31 @@ func New(config ...Config) *Storage {
|
||||
cfg := configDefault(config...)
|
||||
|
||||
// Create data source name
|
||||
var dsn string = "postgresql://"
|
||||
if cfg.Username != "" {
|
||||
dsn += url.QueryEscape(cfg.Username)
|
||||
}
|
||||
if cfg.Password != "" {
|
||||
dsn += ":" + cfg.Password
|
||||
}
|
||||
if cfg.Username != "" || cfg.Password != "" {
|
||||
dsn += "@"
|
||||
}
|
||||
// unix socket host path
|
||||
if strings.HasPrefix(cfg.Host, "/") {
|
||||
dsn += fmt.Sprintf("%s:%d", cfg.Host, cfg.Port)
|
||||
var dsn string
|
||||
if cfg.ConnectionURI != "" {
|
||||
dsn = cfg.ConnectionURI
|
||||
} else {
|
||||
dsn += fmt.Sprintf("%s:%d", url.QueryEscape(cfg.Host), cfg.Port)
|
||||
dsn = "postgresql://"
|
||||
if cfg.Username != "" {
|
||||
dsn += url.QueryEscape(cfg.Username)
|
||||
}
|
||||
if cfg.Password != "" {
|
||||
dsn += ":" + cfg.Password
|
||||
}
|
||||
if cfg.Username != "" || cfg.Password != "" {
|
||||
dsn += "@"
|
||||
}
|
||||
// unix socket host path
|
||||
if strings.HasPrefix(cfg.Host, "/") {
|
||||
dsn += fmt.Sprintf("%s:%d", cfg.Host, cfg.Port)
|
||||
} else {
|
||||
dsn += fmt.Sprintf("%s:%d", url.QueryEscape(cfg.Host), cfg.Port)
|
||||
}
|
||||
dsn += fmt.Sprintf("/%s?connect_timeout=%d&sslmode=%s",
|
||||
url.QueryEscape(cfg.Database),
|
||||
int64(cfg.timeout.Seconds()),
|
||||
cfg.SslMode)
|
||||
}
|
||||
dsn += fmt.Sprintf("/%s?connect_timeout=%d&sslmode=%s",
|
||||
url.QueryEscape(cfg.Database),
|
||||
int64(cfg.timeout.Seconds()),
|
||||
cfg.SslMode)
|
||||
|
||||
// Create db
|
||||
db, err := sql.Open("postgres", dsn)
|
||||
@@ -184,6 +189,11 @@ func (s *Storage) Close() error {
|
||||
return s.db.Close()
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *sql.DB {
|
||||
return s.db
|
||||
}
|
||||
|
||||
// gcTicker starts the gc ticker
|
||||
func (s *Storage) gcTicker() {
|
||||
ticker := time.NewTicker(s.gcInterval)
|
||||
|
@@ -177,3 +177,7 @@ func Test_SslRequiredMode(t *testing.T) {
|
||||
func Test_Postgres_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Postgres_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *redis.Client
|
||||
```
|
||||
### 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:
|
||||
@@ -86,11 +87,11 @@ type Config struct {
|
||||
// Optional. Default is 0
|
||||
Database int
|
||||
|
||||
// URL the standard format redis url to parse all other options. If this is set all other config options, Host, Port, Username, Password, Database have no effect.
|
||||
//
|
||||
// Example: redis://<user>:<pass>@localhost:6379/<db>
|
||||
// Optional. Default is ""
|
||||
URL string
|
||||
// URL the standard format redis url to parse all other options. If this is set all other config options, Host, Port, Username, Password, Database have no effect.
|
||||
//
|
||||
// Example: redis://<user>:<pass>@localhost:6379/<db>
|
||||
// Optional. Default is ""
|
||||
URL string
|
||||
|
||||
// Reset clears any existing keys in existing Collection
|
||||
//
|
||||
|
@@ -99,3 +99,8 @@ func (s *Storage) Reset() error {
|
||||
func (s *Storage) Close() error {
|
||||
return s.db.Close()
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *redis.Client {
|
||||
return s.db
|
||||
}
|
||||
|
@@ -123,6 +123,10 @@ func Test_Redis_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Redis_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
||||
func Test_Redis_Initalize_WithURL(t *testing.T) {
|
||||
testStoreUrl := New(Config{
|
||||
URL: "redis://localhost:6379",
|
||||
|
@@ -18,6 +18,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *ristretto.Cache
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
@@ -89,3 +89,8 @@ func (s *Storage) Close() error {
|
||||
s.cache.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *ristretto.Cache {
|
||||
return s.cache
|
||||
}
|
||||
|
@@ -126,3 +126,7 @@ func Test_Ristretto_Reset(t *testing.T) {
|
||||
func Test_Ristretto_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_Ristretto_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *s3.Client
|
||||
```
|
||||
### Installation
|
||||
S3 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:
|
||||
|
10
s3/go.mod
10
s3/go.mod
@@ -3,10 +3,10 @@ module github.com/gofiber/storage/s3
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.8
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.15
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.10
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.21
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.2
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.11
|
||||
github.com/aws/aws-sdk-go-v2/config v1.17.1
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.14
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.27
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.5
|
||||
github.com/gofiber/utils v0.1.2
|
||||
)
|
||||
|
72
s3/go.sum
72
s3/go.sum
@@ -1,39 +1,39 @@
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.8 h1:gOe9UPR98XSf7oEJCcojYg+N2/jCRm4DdeIsP85pIyQ=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.8/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 h1:S/ZBwevQkr7gv5YxONYpGQxlMFFYSRfz3RMcjsC9Qhk=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3/go.mod h1:gNsR5CaXKmQSSzrmGxmwmct/r+ZBfbxorAuXYsj/M5Y=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.15 h1:yBV+J7Au5KZwOIrIYhYkTGJbifZPCkAnCFSvGsF3ui8=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.15/go.mod h1:A1Lzyy/o21I5/s2FbyX5AevQfSVXpvvIDCoVFD0BC4E=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.10 h1:7gGcMQePejwiKoDWjB9cWnpfVdnz/e5JwJFuT6OrroI=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.10/go.mod h1:g5eIM5XRs/OzIIK81QMBl+dAuDyoLN0VYaLP+tBqEOk=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9 h1:hz8tc+OW17YqxyFFPSkvfSikbqWcyyHRyPVSTzC0+aI=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9/go.mod h1:KDCCm4ONIdHtUloDcFvK2+vshZvx4Zmj7UMDfusuz5s=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.21 h1:bpiKFJ9aC0xTVpygSRRRL/YHC1JZ+pHQHENATHuoiwo=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.21/go.mod h1:iIYPrQ2rYfZiB/iADYlhj9HHZ9TTi6PqKQPAqygohbE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15 h1:bx5F2mr6H6FC7zNIQoDoUr8wEKnvmwRncujT3FYRtic=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15/go.mod h1:pWrr2OoHlT7M/Pd2y4HV3gJyPb3qj5qMmnPkKSNPYK4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9 h1:5sbyznZC2TeFpa4fvtpvpcGbzeXEEs1l1Jo51ynUNsQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9/go.mod h1:08tUpeSGN33QKSO7fwxXczNfiwCpbj+GxK6XKwqWVv0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16 h1:f0ySVcmQhwmzn7zQozd8wBM3yuGBfzdpsOaKQ0/Epzw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16/go.mod h1:CYmI+7x03jjJih8kBEEFKRQc40UjUokT0k7GbvrhhTc=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.6 h1:3L8pcjvgaSOs0zzZcMKzxDSkYKEpwJ2dNVDdxm68jAY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.6/go.mod h1:O7Oc4peGZDEKlddivslfYFvAbgzvl/GH3J8j3JIGBXc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3 h1:4n4KCtv5SUoT5Er5XV41huuzrCqepxlW3SDI9qHQebc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3/go.mod h1:gkb2qADY+OHaGLKNTYxMaQNacfeyQpZ4csDTQMeFmcw=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.10 h1:7LJcuRalaLw+GYQTMGmVUl4opg2HrDZkvn/L3KvIQfw=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.10/go.mod h1:Qks+dxK3O+Z2deAhNo6cJ8ls1bam3tUGUAcgxQP1c70=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9 h1:sHfDuhbOuuWSIAEDd3pma6p0JgUcR2iePxtCE8gfCxQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9/go.mod h1:yQowTpvdZkFVuHrLBXmczat4W+WJKg/PafBZnGBLga0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.9 h1:sJdKvydGYDML9LTFcp6qq6Z5fIjN0Rdq2Gvw1hUg8tc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.9/go.mod h1:Rc5+wn2k8gFSi3V1Ch4mhxOzjMh+bYSXVFfVaqowQOY=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.2 h1:NvzGue25jKnuAsh6yQ+TZ4ResMcnp49AWgWGm2L4b5o=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.2/go.mod h1:u+566cosFI+d+motIz3USXEh6sN8Nq4GrNXSg2RXVMo=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.13 h1:DQpf+al+aWozOEmVEdml67qkVZ6vdtGUi71BZZWw40k=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.13/go.mod h1:d7ptRksDDgvXaUvxyHZ9SYh+iMDymm94JbVcgvSYSzU=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.10 h1:7tquJrhjYz2EsCBvA9VTl+sBAAh1bv7h/sGASdZOGGo=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.10/go.mod h1:cftkHYN6tCDNfkSasAmclSfl4l7cySoay8vz7p/ce0E=
|
||||
github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0=
|
||||
github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdbC0YQ=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.4 h1:zfT11pa7ifu/VlLDpmc5OY2W4nYmnKkFDGeMVnmqAI0=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.4/go.mod h1:ES0I1GBs+YYgcDS1ek47Erbn4TOL811JKqBXtgzqyZ8=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.17.1 h1:BWxTjokU/69BZ4DnLrZco6OvBDii6ToEdfBL/y5I1nA=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.17.1/go.mod h1:uOxDHjBemNTF2Zos+fgG0NNfE86wn1OAHDTGxjMEYi0=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.14 h1:AtVG/amkjbDBfnPr/tuW2IG18HGNznP6L12Dx0rLz+Q=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.12.14/go.mod h1:opAndTyq+YN7IpVG57z2CeNuXSQMqTYxGGlYH0m0RMY=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 h1:wgJBHO58Pc1V1QAnzdVM3JK3WbE/6eUF0JxCZ+/izz0=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.27 h1:xFXIMBci0UXStoOHq/8w0XIZPB2hgb9CD7uATJhqt10=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.27/go.mod h1:+tj2cHQkChanggNZn1J2fJ1Cv6RO1TV0AA3472do31I=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 h1:OmiwoVyLKEqqD5GvB683dbSqxiOfvx4U2lDZhG2Esc4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18/go.mod h1:348MLhzV1GSlZSMusdwQpXKbhD7X2gbI/TxwAPKkYZQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 h1:5mvQDtNWtI6H56+E4LUnLWEmATMB7oEh+Z9RurtIuC0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12/go.mod h1:ckaCVTEdGAxO6KwTGzgskxR1xM+iJW4lxMyDFVda2Fc=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 h1:g5qq9sgtEzt2szMaDqQO6fqKe026T6dHTFJp5NsPzkQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19/go.mod h1:cVHo8KTuHjShb9V8/VjH3S/8+xPu16qx8fdGwmotJhE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.9 h1:agLpf3vtYX1rtKTrOGpevdP3iC2W0hKDmzmhhxJzL+A=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.9/go.mod h1:cv+n1mdyh+0B8tAtlEBzTYFA2Uv15SISEn6kabYhIgE=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.5 h1:g1ITJ9i9ixa+/WVggLNK20KyliAA8ltnuxfZEDfo2hM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.5/go.mod h1:oehQLbMQkppKLXvpx/1Eo0X47Fe+0971DXC9UjGnKcI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.13 h1:3GamN8jcdz/a3nvL/ZVtoH/6xxeshfsiXj5O+6GW4Rg=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.13/go.mod h1:89CSPn69UECDLVn0H6FwKNgbtirksl8C8i3aBeeeihw=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 h1:7iPTTX4SAI2U2VOogD7/gmHlsgnYSgoNHt7MSQXtG2M=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.12 h1:QFjSOmHSb77qRTv7KI9UFon9X5wLWY5/M+6la3dTcZc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.12/go.mod h1:MADjAN0GHFDuc5lRa5Y5ki+oIO/w7X4qczHy+OUx0IA=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.5 h1:h9qqTedYnA9JcWjKyLV6UYIMSdp91ExLCUbjbpDLH7A=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.5/go.mod h1:J8SS5Tp/zeLxaubB0xGfKnVrvssNBNLwTipreTKLhjQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.17 h1:pXxu9u2z1UqSbjO9YA8kmFJBhFc1EVTDaf7A+S+Ivq8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.17/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 h1:dl8T0PJlN92rvEGOEUiD0+YPYdPEaCZK0TqHukvSfII=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0=
|
||||
github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag=
|
||||
github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gofiber/utils v0.1.2 h1:1SH2YEz4RlNS0tJlMJ0bGwO0JkqPqvq6TbHK9tXZKtk=
|
||||
|
5
s3/s3.go
5
s3/s3.go
@@ -159,6 +159,11 @@ func (s *Storage) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *s3.Client {
|
||||
return s.svc
|
||||
}
|
||||
|
||||
// Context for making requests will timeout if a non-zero timeout is configured
|
||||
func (s *Storage) requestContext() (context.Context, context.CancelFunc) {
|
||||
if s.requestTimeout > 0 {
|
||||
|
@@ -105,3 +105,7 @@ func Test_S3_Reset(t *testing.T) {
|
||||
func Test_S3_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_S3_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||
func (s *Storage) Delete(key string) error
|
||||
func (s *Storage) Reset() error
|
||||
func (s *Storage) Close() error
|
||||
func (s *Storage) Conn() *sql.DB
|
||||
```
|
||||
### Installation
|
||||
SQLite3 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:
|
||||
|
@@ -4,5 +4,5 @@ go 1.14
|
||||
|
||||
require (
|
||||
github.com/gofiber/utils v0.1.2
|
||||
github.com/mattn/go-sqlite3 v1.14.14
|
||||
github.com/mattn/go-sqlite3 v1.14.15
|
||||
)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
github.com/gofiber/utils v0.1.2 h1:1SH2YEz4RlNS0tJlMJ0bGwO0JkqPqvq6TbHK9tXZKtk=
|
||||
github.com/gofiber/utils v0.1.2/go.mod h1:pacRFtghAE3UoknMOUiXh2Io/nLWSUHtQCi/3QASsOc=
|
||||
github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw=
|
||||
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
|
@@ -169,3 +169,8 @@ func (s *Storage) gcTicker() {
|
||||
func (s *Storage) gc(t time.Time) {
|
||||
_, _ = s.db.Exec(s.sqlGC, t.Unix())
|
||||
}
|
||||
|
||||
// Return database client
|
||||
func (s *Storage) Conn() *sql.DB {
|
||||
return s.db
|
||||
}
|
||||
|
@@ -159,3 +159,7 @@ func Test_SQLite3_Non_UTF8(t *testing.T) {
|
||||
func Test_SQLite3_Close(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, testStore.Close())
|
||||
}
|
||||
|
||||
func Test_SQLite3_Conn(t *testing.T) {
|
||||
utils.AssertEqual(t, true, testStore.Conn() != nil)
|
||||
}
|
Reference in New Issue
Block a user