package service import "axolotl/models" type NodeService interface { Create(title, content, dueDate string, tags []string, rels map[models.RelType][]string) (*models.Node, error) Update(node *models.Node) error Delete(id string) error GetByID(id string) (*models.Node, error) List(opts ...ListOption) ([]*models.Node, error) Exists(id string) (bool, error) CanClose(id string) (bool, []string, error) } func InitNodeService(path string) error { return InitSqliteDB(path) } func GetNodeService(cfg Config) (NodeService, error) { db, err := GetSqliteDB(cfg) if err != nil { return nil, err } return &sqliteNodeService{db: db, userID: cfg.GetUser()}, nil } type listFilter struct { tagPrefixes []string assignee string mentionsUser string } type ListOption func(*listFilter) func WithTags(prefixes ...string) ListOption { return func(f *listFilter) { f.tagPrefixes = prefixes } } func WithAssignee(userID string) ListOption { return func(f *listFilter) { f.assignee = userID } } func WithMentions(userID string) ListOption { return func(f *listFilter) { f.mentionsUser = userID } }