mirror of
https://github.com/gofiber/storage.git
synced 2025-10-28 10:41:27 +08:00
Replace NewClient with mongo.Connect
This commit is contained in:
committed by
GitHub
parent
4b89c87336
commit
9190b12c2e
4
.github/workflows/golangci-lint.yml
vendored
4
.github/workflows/golangci-lint.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Golangci Lint Check
|
name: Golangci-Lint Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
DIRECTORIES=$(find . -type d -not -path '*/\.*' | jq -R -s -c 'split("\n")[:-1]')
|
DIRECTORIES=$(find . -type d -not -path '*/\.*' | jq -R -s -c 'split("\n")[:-1]')
|
||||||
echo "matrix=${DIRECTORIES}" >> $GITHUB_OUTPUT
|
echo "matrix=${DIRECTORIES}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
golangci-lint:
|
lint:
|
||||||
needs: generate-matrix
|
needs: generate-matrix
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
@@ -53,11 +53,13 @@ func New(config ...Config) *Storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set mongo options
|
// Set mongo options
|
||||||
opt := options.Client()
|
opt := options.Client().ApplyURI(dsn)
|
||||||
opt.ApplyURI(dsn)
|
|
||||||
|
|
||||||
// Create mongo client
|
// Create and connect the mongo client in one step
|
||||||
client, err := mongo.NewClient(opt)
|
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
client, err := mongo.Connect(ctx, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user