28 lines
617 B
Go
28 lines
617 B
Go
package graph_queries
|
|
|
|
const DefaultID = "default"
|
|
|
|
var definitions = []Definition{
|
|
{Meta: Meta{ID: DefaultID, Label: "Default"}, EdgeQuery: defaultEdgeQuery},
|
|
{Meta: Meta{ID: "hierarchy", Label: "Hierarchy"}, EdgeQuery: hierarchyEdgeQuery},
|
|
{Meta: Meta{ID: "types", Label: "Types"}, EdgeQuery: typesOnlyEdgeQuery},
|
|
}
|
|
|
|
func List() []Meta {
|
|
out := make([]Meta, 0, len(definitions))
|
|
for _, d := range definitions {
|
|
out = append(out, d.Meta)
|
|
}
|
|
return out
|
|
}
|
|
|
|
func Get(id string) (Definition, bool) {
|
|
for _, d := range definitions {
|
|
if d.Meta.ID == id {
|
|
return d, true
|
|
}
|
|
}
|
|
return Definition{}, false
|
|
}
|
|
|