Finished event to subgraph conversion.

Wrote expander pattern for custom rules.
This commit is contained in:
Jay
2026-03-03 12:54:36 -05:00
parent e734fc77ed
commit 96f1ceb362
4 changed files with 173 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ import (
roots "git.wisehodl.dev/jay/go-roots/events"
)
func EventToSubgraph(e roots.Event) *Subgraph {
func EventToSubgraph(e roots.Event, exp ExpanderRegistry) *Subgraph {
subgraph := NewSubgraph()
// Create Event node
@@ -45,6 +45,11 @@ func EventToSubgraph(e roots.Event) *Subgraph {
subgraph.AddRel(rel)
}
// Run expanders
for _, expander := range exp {
expander(e, subgraph)
}
return subgraph
}