bookmarks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package bookmarks stores named pointers into Codog workspaces and sessions.

Package bookmarks stores and resolves named workspace and session references.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bookmark

type Bookmark struct {
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	Workspace    string    `json:"workspace,omitempty"`
	SessionID    string    `json:"session_id,omitempty"`
	MessageIndex *int      `json:"message_index,omitempty"`
	PRRepo       string    `json:"pr_repo,omitempty"`
	PRNumber     int       `json:"pr_number,omitempty"`
	PRURL        string    `json:"pr_url,omitempty"`
	Note         string    `json:"note,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

Bookmark is a named pointer to a workspace, session, and optional message.

type ListOptions

type ListOptions struct {
	Workspace string
	All       bool
}

ListOptions controls workspace filtering for list and clear operations.

type Store

type Store struct {
	ConfigHome string
	Now        func() time.Time
	NewID      func() (string, error)
}

Store persists bookmarks under the Codog config home.

func NewStore

func NewStore(configHome string) Store

NewStore creates a bookmark store rooted at configHome.

func (Store) Add

func (s Store) Add(bookmark Bookmark) (Bookmark, error)

Add stores a bookmark and fills in its ID and timestamps when needed.

func (Store) Clear

func (s Store) Clear(options ListOptions) (int, error)

Clear removes matching bookmarks and returns the number removed.

func (Store) Delete

func (s Store) Delete(ref string) (Bookmark, error)

Delete removes the first bookmark matching ref as either ID or name.

func (Store) Get

func (s Store) Get(ref string) (Bookmark, error)

Get finds the first bookmark matching ref as either ID or name.

func (Store) List

func (s Store) List(options ListOptions) ([]Bookmark, error)

List returns bookmarks, newest first, optionally scoped to a workspace.

func (Store) Path

func (s Store) Path() (string, error)

Path returns the bookmark JSON file path.

Jump to

Keyboard shortcuts

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