docs(post): added function documentation

Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
SoXX 2024-05-31 15:27:05 +02:00
parent 1017eaf5b8
commit a61c300b74
3 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
log "github.com/sirupsen/logrus" 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 { func CreateSourceNode(ctx context.Context, driver neo4j.DriverWithContext, anthroveSource *models.AnthroveSource) error {
query := ` query := `
MERGE (sourceNode:Source {domain: $source_url}) MERGE (sourceNode:Source {domain: $source_url})

View File

@ -2,10 +2,13 @@ package graph
import ( import (
"context" "context"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models" "git.dragse.it/anthrove/otter-space-sdk/pkg/models"
) )
type Source interface { 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 CreateSource(ctx context.Context, anthroveSource *models.AnthroveSource) error
DeleteSource(ctx context.Context, anthroveSource *models.AnthroveSource) error DeleteSource(ctx context.Context, anthroveSource *models.AnthroveSource) error

View File

@ -8,6 +8,7 @@ import (
"git.dragse.it/anthrove/otter-space-sdk/pkg/models" "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 { func (g *graphConnection) CreateSource(ctx context.Context, anthroveSource *models.AnthroveSource) error {
return source.CreateSourceNode(ctx, g.driver, anthroveSource) return source.CreateSourceNode(ctx, g.driver, anthroveSource)
} }