store

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 4 Imported by: 1 module, 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 store defines the pluggable data-source backend for fm. Third-party store authors import only this package — never internal/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnumOptions

type EnumOptions struct {
	// IncludeHidden requests that items whose names begin with '.' not be
	// filtered out. File stores apply this to basenames; API stores ignore it.
	IncludeHidden bool
}

EnumOptions carries per-enumeration settings that the store may consult.

type FileStore

type FileStore struct {
	Fmt Format
}

FileStore is a concrete Store for any file-based format. It implements Enumerate (glob expansion + hidden-file filter) once, and delegates Read/Write to the supplied Format. Label returns the path unchanged.

func (FileStore) Enumerate

func (fs FileStore) Enumerate(patterns []string, opts EnumOptions) ([]string, error)

func (FileStore) Label

func (fs FileStore) Label(key string) string

func (FileStore) Read

func (fs FileStore) Read(key string) (map[string]any, error)

func (FileStore) Write

func (fs FileStore) Write(key string, fields map[string]any) error

type Format

type Format interface {
	Read(path string) (map[string]any, error)
	Write(path string, fields map[string]any) error
}

Format handles reading and writing a single file. Glob expansion and hidden- file filtering are provided by FileStore, so Format authors only need to care about the file contents.

type Store

type Store interface {
	// Enumerate resolves FROM-clause pattern tokens into opaque item keys.
	// File stores receive glob strings; API stores receive domain-specific
	// identifiers (project keys, JQL, URLs, …). The store interprets them.
	Enumerate(patterns []string, opts EnumOptions) ([]string, error)

	// Read returns the field map for one item. The key is a value previously
	// returned by Enumerate.
	Read(key string) (map[string]any, error)

	// Write persists a mutated field map. Only called when a mutation
	// statement succeeded and DryRun is false.
	Write(key string, fields map[string]any) error

	// Label returns a human-readable display name for the key, used as the
	// row identifier in output tables (the "filename" column).
	Label(key string) string
}

Store is the pluggable data-source backend. The executor calls it to enumerate items, read their fields, write mutations back, and label them in output tables.

Directories

Path Synopsis
Package markdown implements store.Format for Markdown files with YAML frontmatter.
Package markdown implements store.Format for Markdown files with YAML frontmatter.

Jump to

Keyboard shortcuts

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