Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶
type Metadata map[string]interface{}
Metadata aliases the flexible YAML frontmatter map.
type Note ¶
type Note struct {
ID string // Typically the filename without extension
Metadata Metadata // Parsed YAML frontmatter
Content string // The markdown body
}
Note represents a Markdown file with optional YAML frontmatter.
type Transaction ¶ added in v0.2.0
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents a multi-step operation that holds the lock.
func (*Transaction) Apply ¶ added in v0.2.0
func (tx *Transaction) Apply(msg string) error
Apply persists the transaction changes: git add + git commit + unlock.
func (*Transaction) Rollback ¶ added in v0.2.0
func (tx *Transaction) Rollback() error
Rollback undoes changes made during the transaction and releases the lock.
func (*Transaction) Write ¶ added in v0.2.0
func (tx *Transaction) Write(n *Note) error
Write saves a note to disk within the transaction. It does NOT stage the file in Git.
type Vault ¶
type Vault struct {
Path string
Git *git.Client
Logger *slog.Logger
// contains filtered or unexported fields
}
Vault represents a directory containing notes backed by Git.
func NewVault ¶
NewVault creates a Vault instance rooted at the given path. It ensures the path exists and initializes the Git client.
func (*Vault) Begin ¶ added in v0.2.0
func (v *Vault) Begin() (*Transaction, error)
Begin starts a new transaction. It acquires the global lock.
func (*Vault) List ¶
List returns a list of all notes in the vault. It scans the directory recursively for .md files and parses them.
func (*Vault) Read ¶
Read loads a note by its ID (filename without extension). It looks for {ID}.md in the vault root.