Help us shape the future of Go! Take the 2026 Go Developer Survey

recents

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package recents provides a store for tracking recently used items.

Index

Constants

View Source
const (
	TypeProject   = "project"
	TypeTodolist  = "todolist"
	TypeRecording = "recording"
	TypePerson    = "person"
)

ItemTypes for common entities.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID          string    `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description,omitempty"`
	Type        string    `json:"type"`
	AccountID   string    `json:"account_id,omitempty"`
	ProjectID   string    `json:"project_id,omitempty"`
	UsedAt      time.Time `json:"used_at"`
}

Item represents a recently used item.

type Store

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

Store manages recently used items.

func NewStore

func NewStore(cacheDir string) *Store

NewStore creates a new recent items store. The store file is located at <cacheDir>/recents.json.

func (*Store) Add

func (s *Store) Add(item Item)

Add adds or updates an item in the recent items list.

func (*Store) Clear

func (s *Store) Clear(itemType string)

Clear removes all items of the specified type.

func (*Store) ClearAll

func (s *Store) ClearAll()

ClearAll removes all recent items.

func (*Store) Get

func (s *Store) Get(itemType string, accountID, projectID string) []Item

Get returns recent items of the specified type, optionally filtered by account/project. Returns a copy of the items to prevent callers from mutating internal state.

func (*Store) LastError

func (s *Store) LastError() error

LastError returns the last error from a save operation, if any. Useful for debugging persistence issues.

Jump to

Keyboard shortcuts

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