Files
ax/db/rel.go

20 lines
449 B
Go
Raw Normal View History

2026-03-26 12:48:47 +00:00
package db
import "axolotl/models"
func (db *DB) GetRelNames(n *models.Node, r models.RelType) ([]string, error) {
2026-03-29 18:58:34 +02:00
ids := n.Relations[string(r)]
if len(ids) == 0 {
return nil, nil
}
result := make([]string, 0, len(ids))
for _, id := range ids {
var title string
if err := db.QueryRow("SELECT title FROM nodes WHERE id = ?", id).Scan(&title); err != nil {
return nil, err
}
2026-03-29 18:58:34 +02:00
result = append(result, title)
}
return result, nil
}