diff --git a/internal/source/source.go b/internal/source/source.go index fde7798..8ae40c5 100644 --- a/internal/source/source.go +++ b/internal/source/source.go @@ -9,6 +9,7 @@ import ( log "github.com/sirupsen/logrus" ) +// CreateSourceNode will always create a new node, it checks if a node with the same url exits and merges it. func CreateSourceNode(ctx context.Context, driver neo4j.DriverWithContext, anthroveSource *models.AnthroveSource) error { query := ` MERGE (sourceNode:Source {domain: $source_url}) diff --git a/pkg/graph/source.go b/pkg/graph/source.go index 7968cdd..903a439 100644 --- a/pkg/graph/source.go +++ b/pkg/graph/source.go @@ -2,10 +2,13 @@ package graph import ( "context" + "git.dragse.it/anthrove/otter-space-sdk/pkg/models" ) type Source interface { + + // CreateSource will always create a new node, it checks if a node with the same url exits and merges it. CreateSource(ctx context.Context, anthroveSource *models.AnthroveSource) error DeleteSource(ctx context.Context, anthroveSource *models.AnthroveSource) error diff --git a/pkg/graph/source_impl.go b/pkg/graph/source_impl.go index fd96c0e..ca9e4bc 100644 --- a/pkg/graph/source_impl.go +++ b/pkg/graph/source_impl.go @@ -8,6 +8,7 @@ import ( "git.dragse.it/anthrove/otter-space-sdk/pkg/models" ) +// CreateSource will always create a new node, it checks if a node with the same url exits and merges it. func (g *graphConnection) CreateSource(ctx context.Context, anthroveSource *models.AnthroveSource) error { return source.CreateSourceNode(ctx, g.driver, anthroveSource) }