mirror of
https://github.com/MedzikUser/go-cdn
synced 2024-08-15 03:19:36 +00:00
25 lines
493 B
Go
25 lines
493 B
Go
|
package database
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
|
||
|
"gitlab.com/gaming0skar123/go/cdn/common"
|
||
|
"gitlab.com/gaming0skar123/go/cdn/config"
|
||
|
)
|
||
|
|
||
|
type Imgur struct {
|
||
|
ID string `bson:"_id"`
|
||
|
DelHash string `bson:"delHash"`
|
||
|
}
|
||
|
|
||
|
func InsertImgur(imgur *Imgur) {
|
||
|
collection := DB.Collection(config.Mongo_Collection_Imgur)
|
||
|
|
||
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||
|
defer cancel()
|
||
|
|
||
|
_, err := collection.InsertOne(ctx, imgur)
|
||
|
common.CheckErr(err, "inserting to DB")
|
||
|
}
|