Files
ax/models/node.go

36 lines
870 B
Go
Raw Normal View History

2026-03-26 12:48:47 +00:00
package models
import "strings"
type Node struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content,omitempty"`
DueDate string `json:"due_date,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Tags []string `json:"tags,omitempty"`
Relations map[string][]string `json:"relations,omitempty"`
}
func (n *Node) GetProperty(k string) string {
2026-03-26 12:48:47 +00:00
for _, t := range n.Tags {
if strings.HasPrefix(t, "_") {
if p := strings.SplitN(t[1:], "::", 2); len(p) == 2 && p[0] == k {
return p[1]
}
2026-03-26 12:48:47 +00:00
}
}
return ""
2026-03-26 12:48:47 +00:00
}
func (n *Node) GetDisplayTags() []string {
var tags []string
for _, t := range n.Tags {
if !strings.HasPrefix(t, "_") {
tags = append(tags, t)
}
}
return tags
}