From 13d13962ed55c340cc02f7529e7977b240ac6201 Mon Sep 17 00:00:00 2001 From: jojo Date: Fri, 19 Jan 2024 10:48:50 -0300 Subject: [PATCH] :bug: distinct eng urls name --- cmd/newsletter/main.go | 2 +- mongodb/newsletter.go | 4 ++-- mongodb/newsletter_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/newsletter/main.go b/cmd/newsletter/main.go index dfc5612..42b23cf 100644 --- a/cmd/newsletter/main.go +++ b/cmd/newsletter/main.go @@ -88,7 +88,7 @@ func main() { defer close(URLCh) for range time.Tick(cfg.LoopDurationMinutes) { slog.Info("fetching engineers") - gotURLs, err := storage.DistinctEngineerURL(ctx) + gotURLs, err := storage.DistinctEngineerURLs(ctx) if err != nil { slog.Error("error getting engineers", "error", err) signalCh <- syscall.SIGTERM diff --git a/mongodb/newsletter.go b/mongodb/newsletter.go index 2950992..ef05e39 100644 --- a/mongodb/newsletter.go +++ b/mongodb/newsletter.go @@ -52,8 +52,8 @@ func (m *NLStorage) SaveEngineer(ctx context.Context, e Engineer) error { return nil } -// DistinctEngineerURL returns all url sites of each distinct engineer -func (m *NLStorage) DistinctEngineerURL(ctx context.Context) ([]interface{}, error) { +// DistinctEngineerURLs returns all url sites of each distinct engineer +func (m *NLStorage) DistinctEngineerURLs(ctx context.Context) ([]interface{}, error) { database := m.client.Database(m.DBName) collection := database.Collection("engineers") diff --git a/mongodb/newsletter_test.go b/mongodb/newsletter_test.go index 1e586a8..a8baf15 100644 --- a/mongodb/newsletter_test.go +++ b/mongodb/newsletter_test.go @@ -216,7 +216,7 @@ func TestNLStorageSaveEngineer(t *testing.T) { t.Cleanup(teardown(ctx, client, DBName)) } -func TestNLSEngineersURL(t *testing.T) { +func TestNLStorageDistinctEngineerURLs(t *testing.T) { ctx := context.Background() client, DBName := setup(ctx, t) @@ -249,7 +249,7 @@ func TestNLSEngineersURL(t *testing.T) { t.Fatal("error saving 3 engineer", err) } - got, err := NLStorage.DistinctEngineerURL(ctx) + got, err := NLStorage.DistinctEngineerURLs(ctx) if err != nil { t.Fatal("error getting engineers", err) }