testvault

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: BSD-2-Clause Imports: 7 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Dir string

	// Only restricts the listing to these vault-relative paths when non-empty.
	// Specs use it to model an index that sees a narrower set than the whole dir.
	Only []string
	// ListErr makes the listing fail, for specs that assert an error path.
	ListErr error
	// ReadErrOn makes a read of the named task fail, for specs that model a
	// transient failure the caller must not mistake for absence.
	ReadErrOn map[string]error
	// PatchErr makes every typed write fail, for specs that assert the caller
	// swallows a write error.
	PatchErr error
	// contains filtered or unexported fields
}

Client serves vaultapi.Client from a directory of markdown files.

func (*Client) CreateTask

func (f *Client) CreateTask(
	_ context.Context,
	task vaultapi.Task,
	_ vaultapi.CreateOptions,
) (*vaultapi.Task, error)

CreateTask writes a new task file named after the title.

func (*Client) ListTasks

func (f *Client) ListTasks(
	_ context.Context,
	_ vaultapi.Filter,
) ([]vaultapi.Task, error)

ListTasks returns every task under Dir.

func (*Client) ListTasksCallCount

func (f *Client) ListTasksCallCount() int

ListTasksCallCount reports how many listings were issued.

func (*Client) PatchTask

func (f *Client) PatchTask(
	_ context.Context,
	id string,
	fields map[string]any,
) (*vaultapi.Task, error)

PatchTask replaces the named frontmatter fields.

func (*Client) PatchTaskWithBody

func (f *Client) PatchTaskWithBody(
	_ context.Context,
	id string,
	fields map[string]any,
	body string,
) (*vaultapi.Task, error)

PatchTaskWithBody replaces the named fields and the body in one write.

func (*Client) PatchTaskWithBodyCallCount

func (f *Client) PatchTaskWithBodyCallCount() int

PatchTaskWithBodyCallCount reports how many typed writes were issued.

func (*Client) PutBody

func (f *Client) PutBody(_ context.Context, id string, body string) error

PutBody replaces the body.

func (*Client) ReadTask

func (f *Client) ReadTask(_ context.Context, id string) (*vaultapi.Task, error)

ReadTask returns the task addressed by identifier or title.

func (*Client) ReadTaskCallCount

func (f *Client) ReadTaskCallCount() int

ReadTaskCallCount reports how many single-task reads were issued.

func (*Client) ReaddressTask

func (f *Client) ReaddressTask(
	_ context.Context,
	id string,
	next string,
	previous string,
) (*vaultapi.Task, error)

ReaddressTask moves the task to a new identifier, recording the previous one.

func (*Client) Seed

func (f *Client) Seed(files map[string][]byte) error

Seed writes a path→content map into Dir so a typed read finds it.

Jump to

Keyboard shortcuts

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