feat: add collection-node relationship in collection.FetchNodes()

This commit is contained in:
Alexander Navarro 2024-11-26 09:29:48 -03:00
parent c1684c8dea
commit d1a0212cb1
2 changed files with 29 additions and 1 deletions

View file

@ -100,6 +100,26 @@ func (collection *Collection) FetchNodes(fetcher NodeFetcher, start_pagination P
}
err = BulkCreateNode(collection._conn, collection.childs)
if err != nil {
return err
}
for _, item := range collection.childs {
err := collection.AddRelationship(
&Relationship{
_class: "COLLECTION_HAS_NODE",
From: collection.Id,
To: item.Id,
})
if err != nil {
return err
}
}
err = BulkCreateRelationships(collection._conn, collection._relationships)
if err != nil {
return err
}
return nil
}