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"` } type RelType string const ( RelBlocks RelType = "blocks" RelSubtask RelType = "subtask" RelRelated RelType = "related" RelCreated RelType = "created" RelAssignee RelType = "assignee" RelInNamespace RelType = "in_namespace" RelMentions RelType = "mentions" ) func (n *Node) GetProperty(k string) string { 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] } } } return "" } func (n *Node) GetDisplayTags() []string { var tags []string for _, t := range n.Tags { if !strings.HasPrefix(t, "_") { tags = append(tags, t) } } return tags }