cortex

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(name, dir string) error

Create initialises a new Cortex on disk and registers it. dir is the parent directory; the cortex is created as dir/<name>/.

Types

type Cortex

type Cortex struct {
	Name string
	Dir  string
	DB   *db.DB
}

func Open

func Open(name, dir string) (*Cortex, error)

Open opens an existing Cortex by directory path.

func (*Cortex) Add

func (c *Cortex) Add(t *trace.Trace) error

Add writes a new Trace to disk and inserts it into the DB.

func (*Cortex) Archive

func (c *Cortex) Archive(id string) error

func (*Cortex) ArchiveDir

func (c *Cortex) ArchiveDir() string

func (*Cortex) Close

func (c *Cortex) Close() error

func (*Cortex) Get

func (c *Cortex) Get(id string) (*Row, error)

func (*Cortex) List

func (c *Cortex) List(opts ListOptions) ([]Row, error)

func (*Cortex) Remove

func (c *Cortex) Remove(id string) error

func (*Cortex) Search

func (c *Cortex) Search(query string, opts ListOptions) ([]Row, error)

func (*Cortex) TraceFile

func (c *Cortex) TraceFile(id string, archived bool) string

TraceFile returns the absolute path to a trace's markdown file.

func (*Cortex) TracesDir

func (c *Cortex) TracesDir() string

func (*Cortex) Unarchive

func (c *Cortex) Unarchive(id string) error

func (*Cortex) Update

func (c *Cortex) Update(id string) error

Update rewrites an existing trace's DB row and FTS entry from its (potentially edited) markdown file on disk.

type ListOptions

type ListOptions struct {
	Type     string
	Author   string
	Tag      string
	Archived bool // only archived
	All      bool // active + archived
}

type Manifest

type Manifest struct {
	Name    string `yaml:"name"`
	Purpose string `yaml:"purpose,omitempty"`
	Owner   string `yaml:"owner,omitempty"`
	Created string `yaml:"created"`
	Version int    `yaml:"version"`
}

Manifest is the cortex.md file at the root of each Cortex.

type Row

type Row struct {
	ID         string
	Title      string
	Type       string
	Author     string
	Tags       []string
	ArchivedAt string
	CreatedAt  string
	UpdatedAt  string
}

Row is a DB row joined with tags, returned by list/search operations.

Jump to

Keyboard shortcuts

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