2021-07-29 18:51:15 +00:00
|
|
|
package mongo
|
2021-07-11 21:19:37 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
2021-07-31 20:59:43 +00:00
|
|
|
"gitlab.com/gaming0skar123/go/pingbot/config"
|
2021-07-11 21:19:37 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func GetAll() ([]URL, error) {
|
|
|
|
var results []URL
|
|
|
|
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
|
|
|
defer cancel()
|
|
|
|
|
2021-08-12 21:13:10 +00:00
|
|
|
cursor, err := Coll.Find(ctx, URL{
|
|
|
|
Cluster: config.Toml.Cluster.ID,
|
2021-07-31 20:59:43 +00:00
|
|
|
})
|
2021-07-11 21:19:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = cursor.All(ctx, &results)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return results, nil
|
|
|
|
}
|