mirror of
https://github.com/MedzikUser/go-pingbot
synced 2024-08-14 23:57:07 +00:00
3432a74d23
- Added Cache URLs from Database - and Database Name and Collection set from toml config file
23 lines
397 B
Go
23 lines
397 B
Go
package mongo
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
)
|
|
|
|
func Delete(url string) (*mongo.DeleteResult, error) {
|
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
|
defer cancel()
|
|
|
|
r, err := Coll.DeleteOne(ctx, bson.M{"_id": url})
|
|
if err != nil {
|
|
fmt.Print(err)
|
|
return nil, err
|
|
}
|
|
|
|
return r, err
|
|
}
|