Finished event to subgraph conversion.
Wrote expander pattern for custom rules.
This commit is contained in:
7
event.go
7
event.go
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user