store

package
v0.0.0-...-af6e024 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 9 Imported by: 0 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

Index

Constants

View Source
const (
	NoteExt  = ".md"
	TrashDir = ".trash"
)

Variables

View Source
var (
	ErrExists      = errors.New("already exists")
	ErrInvalidName = errors.New("invalid name")
	ErrOutsideRoot = errors.New("path is outside the notes folder")
)

Functions

func SanitizeName

func SanitizeName(name string) (string, error)

func Title

func Title(rel string) string

Types

type Match

type Match struct {
	Path string
	Line int
	Text string
}

type Node

type Node struct {
	Name     string
	Path     string
	IsDir    bool
	Children []*Node
}

type Store

type Store struct {
	Root string
}

func New

func New(root string) (*Store, error)

func (*Store) Abs

func (s *Store) Abs(rel string) (string, error)

func (*Store) CreateDir

func (s *Store) CreateDir(parent, name string) (string, error)

func (*Store) CreateNote

func (s *Store) CreateNote(dir, title string) (string, error)

func (*Store) ModTime

func (s *Store) ModTime(rel string) (time.Time, error)

func (*Store) Notes

func (s *Store) Notes() ([]string, error)

func (*Store) Read

func (s *Store) Read(rel string) (string, time.Time, error)

func (*Store) Rename

func (s *Store) Rename(rel, newName string) (string, error)

func (*Store) Search

func (s *Store) Search(query string, limit int) ([]Match, error)

func (*Store) Trash

func (s *Store) Trash(rel string) (string, error)

func (*Store) Tree

func (s *Store) Tree() (*Node, error)

func (*Store) Write

func (s *Store) Write(rel, content string) (time.Time, error)

Write replaces the file via a temp file in the same directory and a rename, so a crash mid-write never leaves a truncated note behind.

Jump to

Keyboard shortcuts

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