From e3a5adb2cc56b772c876d2f8ce4659fdc0afe5ac Mon Sep 17 00:00:00 2001 From: SoXX Date: Fri, 31 May 2024 15:37:44 +0200 Subject: [PATCH] doc(source): added function documentation Signed-off-by: SoXX --- internal/source/source.go | 2 +- pkg/graph/source.go | 2 +- pkg/graph/source_impl.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/source/source.go b/internal/source/source.go index 48e992d..1bfdc9c 100644 --- a/internal/source/source.go +++ b/internal/source/source.go @@ -100,8 +100,8 @@ func GetAllSourceNodes(ctx context.Context, driver neo4j.DriverWithContext) ([]m return sources, nil } +// GetSourceNodesByURL returns the first models.AnthroveSource provided by the database func GetSourceNodesByURL(ctx context.Context, driver neo4j.DriverWithContext, sourceUrl string) (*models.AnthroveSource, error) { - var source models.AnthroveSource query := ` diff --git a/pkg/graph/source.go b/pkg/graph/source.go index 08f150f..63f8a09 100644 --- a/pkg/graph/source.go +++ b/pkg/graph/source.go @@ -14,7 +14,7 @@ type Source interface { // DeleteSource will delete a node with a given Domain DeleteSource(ctx context.Context, anthroveSource *models.AnthroveSource) error - // GetSourceByURL returns the Source Node based on the URL + // GetSourceByURL returns the first models.AnthroveSource provided by the database GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) // GetSourceLinkForUser retrieves the links between a user and sources in the OtterSpace graph. diff --git a/pkg/graph/source_impl.go b/pkg/graph/source_impl.go index 56d2b1b..7e03aa5 100644 --- a/pkg/graph/source_impl.go +++ b/pkg/graph/source_impl.go @@ -18,6 +18,7 @@ func (g *graphConnection) DeleteSource(ctx context.Context, anthroveSource *mode return source.DeleteSourceNode(ctx, g.driver, anthroveSource) } +// GetSourceByURL returns the first models.AnthroveSource provided by the database func (g *graphConnection) GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) { return source.GetSourceNodesByURL(ctx, g.driver, sourceUrl) }