vault

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = fmt.Errorf("operation not supported by obsidian backend")

ErrNotSupported is returned for Logseq-specific operations (DataScript queries).

View Source
var ErrReadOnly = fmt.Errorf("obsidian backend is read-only")

ErrReadOnly is returned for write operations on the read-only Obsidian backend.

Functions

This section is empty.

Types

type Client

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

Client implements backend.Backend for an Obsidian vault on disk. It reads all .md files on initialization and serves queries from memory.

func New

func New(vaultPath string, opts ...Option) *Client

New creates a new Obsidian vault client. Call Load() to index the vault.

func (*Client) AppendBlockInPage

func (c *Client) AppendBlockInPage(_ context.Context, page string, content string) (*types.BlockEntity, error)
func (c *Client) BuildBacklinks()

BuildBacklinks must be called after Load() to build the reverse link index.

func (*Client) CreatePage

func (c *Client) CreatePage(_ context.Context, name string, properties map[string]any, opts map[string]any) (*types.PageEntity, error)

func (*Client) DatascriptQuery

func (c *Client) DatascriptQuery(_ context.Context, query string, inputs ...any) (json.RawMessage, error)

func (*Client) FindBlocksByTag

func (c *Client) FindBlocksByTag(_ context.Context, tag string, includeChildren bool) ([]backend.TagResult, error)

FindBlocksByTag scans all pages for blocks containing the given #tag. Implements backend.TagSearcher.

func (*Client) FindByProperty

func (c *Client) FindByProperty(_ context.Context, key, value, operator string) ([]backend.PropertyResult, error)

FindByProperty scans all pages for matching frontmatter properties. Implements backend.PropertySearcher.

func (*Client) GetAllPages

func (c *Client) GetAllPages(_ context.Context) ([]types.PageEntity, error)

func (*Client) GetBlock

func (c *Client) GetBlock(_ context.Context, uuid string, opts ...map[string]any) (*types.BlockEntity, error)

func (*Client) GetPage

func (c *Client) GetPage(_ context.Context, nameOrID any) (*types.PageEntity, error)

func (*Client) GetPageBlocksTree

func (c *Client) GetPageBlocksTree(_ context.Context, nameOrID any) ([]types.BlockEntity, error)

func (*Client) GetPageLinkedReferences

func (c *Client) GetPageLinkedReferences(_ context.Context, nameOrID any) (json.RawMessage, error)

func (*Client) InsertBlock

func (c *Client) InsertBlock(_ context.Context, srcBlock any, content string, opts map[string]any) (*types.BlockEntity, error)

func (*Client) Load

func (c *Client) Load() error

Load reads all .md files in the vault and builds the in-memory index.

func (*Client) MoveBlock

func (c *Client) MoveBlock(_ context.Context, uuid string, targetUUID string, opts map[string]any) error

func (*Client) Ping

func (c *Client) Ping(_ context.Context) error

func (*Client) PrependBlockInPage

func (c *Client) PrependBlockInPage(_ context.Context, page string, content string) (*types.BlockEntity, error)

func (*Client) RemoveBlock

func (c *Client) RemoveBlock(_ context.Context, uuid string) error

func (*Client) SearchJournals

func (c *Client) SearchJournals(_ context.Context, query, from, to string) ([]backend.JournalResult, error)

SearchJournals scans daily notes for matching content. Implements backend.JournalSearcher.

func (*Client) UpdateBlock

func (c *Client) UpdateBlock(_ context.Context, uuid string, content string, opts ...map[string]any) error

type Option

type Option func(*Client)

Option configures a vault Client.

func WithDailyFolder

func WithDailyFolder(folder string) Option

WithDailyFolder sets the daily notes subfolder (default: "daily notes").

Jump to

Keyboard shortcuts

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