Documentation
¶
Index ¶
- type Option
- type YAMLStore
- func (s *YAMLStore) All(scopes []store.Scope) ([]store.Entry, error)
- func (s *YAMLStore) AllByCategory(category string, topK int, scopes []store.Scope) ([]store.Entry, error)
- func (s *YAMLStore) Close() error
- func (s *YAMLStore) Delete(id string) error
- func (s *YAMLStore) Get(id string) (*store.Entry, error)
- func (s *YAMLStore) ListHeads(scopes []store.Scope) ([]store.HeadInfo, error)
- func (s *YAMLStore) Promote(id string, targetScope store.Scope) error
- func (s *YAMLStore) Query(category string, tags []string) ([]store.Entry, error)
- func (s *YAMLStore) QueryByCategory(category, query string, topK int, scopes []store.Scope) ([]store.Entry, error)
- func (s *YAMLStore) Score(id string, delta float64) error
- func (s *YAMLStore) Upsert(entry *store.Entry) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.0.5
type Option func(*options)
Option is a functional option for configuring YAMLStore.
func WithAutoHitCounting ¶ added in v0.0.5
WithAutoHitCounting controls whether queries automatically increment HitCount and LastHit. Enabled by default; pass false to disable.
type YAMLStore ¶
type YAMLStore struct {
// contains filtered or unexported fields
}
YAMLStore holds one or more scope directories, each containing one YAML file per category.
Example layout:
~/.mnemonic/global/ ├── avoidance.yaml └── security.yaml ~/.mnemonic/teams/acme/ └── avoidance.yaml .mnemonic/project/ └── domain.yaml
func New ¶
New creates a YAMLStore. Call with a mapping of scope names to directory paths. Expands "~" to the home directory. Each directory is scanned for *.yaml files on startup; each file is treated as a category (filename without extension).
Example:
store, err := yamlstore.New(map[Scope]string{
"global": "~/.mnemonic/global/",
"team:acme": "~/.mnemonic/teams/acme/",
}, logger)
func (*YAMLStore) AllByCategory ¶
func (s *YAMLStore) AllByCategory(category string, topK int, scopes []store.Scope) ([]store.Entry, error)
AllByCategory returns entries in the given category, sorted by weighted score. Only the per-category file for each scope is accessed, not all files.
func (*YAMLStore) Close ¶
Close stops the background flush goroutine and persists any dirty categories.
func (*YAMLStore) QueryByCategory ¶
func (s *YAMLStore) QueryByCategory(category, query string, topK int, scopes []store.Scope) ([]store.Entry, error)
QueryByCategory returns entries in the given category whose content or tags contain any query term (case-insensitive), sorted by weighted score. Only the per-category file is accessed per scope.