mirror of
https://github.com/gofiber/storage.git
synced 2025-10-31 03:36:25 +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:
|
||||
push:
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
DIRECTORIES=$(find . -type d -not -path '*/\.*' | jq -R -s -c 'split("\n")[:-1]')
|
||||
echo "matrix=${DIRECTORIES}" >> $GITHUB_OUTPUT
|
||||
|
||||
golangci-lint:
|
||||
lint:
|
||||
needs: generate-matrix
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
||||
@@ -53,11 +53,13 @@ func New(config ...Config) *Storage {
|
||||
}
|
||||
|
||||
// Set mongo options
|
||||
opt := options.Client()
|
||||
opt.ApplyURI(dsn)
|
||||
opt := options.Client().ApplyURI(dsn)
|
||||
|
||||
// Create mongo client
|
||||
client, err := mongo.NewClient(opt)
|
||||
// Create and connect the mongo client in one step
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
|
||||
client, err := mongo.Connect(ctx, opt)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user