notes

package
v0.66.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notes is the public Go API for td notes.

Sidecar and other in-process clients should open a Store and call these methods instead of speaking SQL against .todos/issues.db. Writes go through internal/db (withWriteLock + action_log), the same path as `td note`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListOptions

type ListOptions struct {
	Pinned         *bool
	Archived       *bool
	IncludeDeleted bool
	Search         string
	Limit          int
}

ListOptions filters List. Limit <= 0 means unlimited.

type Note

type Note struct {
	ID        string     `json:"id"`
	Title     string     `json:"title"`
	Content   string     `json:"content"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	Pinned    bool       `json:"pinned"`
	Archived  bool       `json:"archived"`
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

Note is a freeform note stored in the project issues.db.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a long-lived handle on a project's notes.

func Init

func Init(baseDir string) (*Store, error)

Init creates a new td database at baseDir and returns a notes Store. Production Sidecar should call Open; Init is for tests and first-run setups.

func Open

func Open(baseDir string) (*Store, error)

Open opens the td database at baseDir (resolving .td-root) for notes access.

func (*Store) Archive

func (s *Store) Archive(id string) error

Archive archives a note.

func (*Store) Close

func (s *Store) Close() error

Close releases the database connection.

func (*Store) Create

func (s *Store) Create(title, content string) (*Note, error)

Create inserts a note.

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete soft-deletes a note.

func (*Store) Get

func (s *Store) Get(id string) (*Note, error)

Get returns a live (not soft-deleted) note.

func (*Store) GetAny

func (s *Store) GetAny(id string) (*Note, error)

GetAny returns a note including soft-deleted rows.

func (*Store) List

func (s *Store) List(opts ListOptions) ([]Note, error)

List returns notes matching opts. Limit <= 0 means unlimited.

func (*Store) Pin

func (s *Store) Pin(id string) error

Pin pins a note.

func (*Store) Restore

func (s *Store) Restore(id string) (*Note, error)

Restore undeletes a soft-deleted note.

func (*Store) Unarchive

func (s *Store) Unarchive(id string) error

Unarchive unarchives a note.

func (*Store) Unpin

func (s *Store) Unpin(id string) error

Unpin unpins a note.

func (*Store) Update

func (s *Store) Update(id, title, content string) (*Note, error)

Update changes title and content.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL