Documentation
¶
Index ¶
- func DefaultDBPath() string
- type Entry
- type NotionClient
- type NotionInstance
- type SQLiteStore
- func (s *SQLiteStore) AllKeys(ctx context.Context, source string) ([]string, error)
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) DeleteEntry(ctx context.Context, key, source string) error
- func (s *SQLiteStore) LastIndexedAt(ctx context.Context, source string) (time.Time, error)
- func (s *SQLiteStore) Search(ctx context.Context, query string, limit int) ([]Entry, error)
- func (s *SQLiteStore) Stats(ctx context.Context) (*Stats, error)
- func (s *SQLiteStore) UpsertEntry(ctx context.Context, entry Entry, description string) error
- type Stats
- type Store
- type SyncNotionResult
- type SyncResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDBPath ¶
func DefaultDBPath() string
DefaultDBPath returns the path to the index database (~/.human/index.db), creating the directory if needed.
Types ¶
type Entry ¶
type Entry struct {
Key string `json:"key"`
Source string `json:"source"` // instance name
Kind string `json:"kind"` // "jira", "github", etc.
Project string `json:"project"`
Title string `json:"title"`
Status string `json:"status"`
Assignee string `json:"assignee"`
URL string `json:"url"` // instance base URL
IndexedAt time.Time `json:"indexed_at"`
}
Entry holds the metadata for a single indexed issue.
type NotionClient ¶
type NotionClient interface {
Search(ctx context.Context, query string) ([]notion.SearchResult, error)
GetPage(ctx context.Context, pageID string) (string, error)
ListDatabases(ctx context.Context) ([]notion.DatabaseEntry, error)
QueryDatabase(ctx context.Context, dbID string) ([]notion.DatabaseRow, error)
}
NotionClient is the subset of notion.Client methods needed by SyncNotion.
type NotionInstance ¶
type NotionInstance struct {
Name string
URL string
Client NotionClient
}
NotionInstance holds a configured Notion workspace for indexing.
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
SQLiteStore implements Store using SQLite with FTS5 full-text search.
func NewSQLiteStore ¶
func NewSQLiteStore(dbPath string) (*SQLiteStore, error)
NewSQLiteStore opens (or creates) a SQLite database at dbPath and ensures the schema is up to date. Use ":memory:" for in-memory databases in tests.
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
Close closes the database connection.
func (*SQLiteStore) DeleteEntry ¶
func (s *SQLiteStore) DeleteEntry(ctx context.Context, key, source string) error
DeleteEntry removes an entry and its FTS index.
func (*SQLiteStore) LastIndexedAt ¶
LastIndexedAt returns the most recent indexed_at timestamp for a given source. Returns the zero time if no entries exist for the source.
func (*SQLiteStore) Search ¶
Search performs a full-text search and returns matching entries ranked by BM25.
func (*SQLiteStore) Stats ¶
func (s *SQLiteStore) Stats(ctx context.Context) (*Stats, error)
Stats returns statistics about the index.
func (*SQLiteStore) UpsertEntry ¶
UpsertEntry inserts or updates an entry and its FTS index.
type Stats ¶
type Stats struct {
TotalEntries int `json:"total_entries"`
LastIndexedAt time.Time `json:"last_indexed_at"`
ByKind map[string]int `json:"by_kind"`
BySource map[string]int `json:"by_source"`
}
Stats summarises the current state of the index.
type Store ¶
type Store interface {
UpsertEntry(ctx context.Context, entry Entry, description string) error
DeleteEntry(ctx context.Context, key, source string) error
Search(ctx context.Context, query string, limit int) ([]Entry, error)
Stats(ctx context.Context) (*Stats, error)
AllKeys(ctx context.Context, source string) ([]string, error)
LastIndexedAt(ctx context.Context, source string) (time.Time, error)
Close() error
}
Store is the persistence interface for the search index.
type SyncNotionResult ¶
SyncNotionResult summarises one Notion sync run.
func SyncNotion ¶
func SyncNotion(ctx context.Context, store Store, instances []NotionInstance, logger io.Writer) (*SyncNotionResult, error)
SyncNotion iterates all Notion instances, discovers pages and databases, fetches content, upserts entries, and prunes stale keys.
type SyncResult ¶
SyncResult summarises one sync run.
func Sync ¶
func Sync(ctx context.Context, store Store, instances []tracker.Instance, fullSync bool, logger io.Writer) (*SyncResult, error)
Sync iterates all instances, lists issues per configured project, fetches descriptions, upserts entries, and prunes stale keys. When fullSync is false, it performs incremental sync using the last indexed timestamp per source to only fetch recently updated issues.