docs(post): added function documentation
Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
parent
1017eaf5b8
commit
a61c300b74
@ -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})
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user