sessionquery

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package sessionquery queries sessions and FTS5 search (S04), matching storage/session-query. It reads the S03 SQLite store through ListSessions, Load, and Search. Titles use the latest title event or the first user-message prefix. ListSummaries filters by title prefix, creation-time range, and limit, ordered by most recent update. Search unions FTS5 body/title hits with title-substring matches and returns summaries.

Session-reference URIs match context/session-reference: opaque session IDs round-trip through canonical omnix-session URIs and Markdown mentions.

Index

Constants

View Source
const Scheme = "omnix-session:"

Scheme is reserved for session snapshot references.

Variables

View Source
var ErrInvalidURI = errors.New("sessionquery: invalid session reference URI")

ErrInvalidURI indicates an invalid or noncanonical session-reference URI.

Functions

func DecodeURI

func DecodeURI(uri string) (string, error)

DecodeURI validates canonical form and decodes, or returns ErrInvalidURI.

func EncodeURI

func EncodeURI(sessionID string) string

EncodeURI losslessly encodes a session ID as a canonical URI.

func FormatMention

func FormatMention(sessionID, label string) string

FormatMention renders a Markdown mention with a canonical URI; empty labels use the ID.

Types

type ListRequest

type ListRequest struct {
	TitlePrefix string     // Optional title-prefix filter.
	CreatedFrom *time.Time // Optional inclusive lower creation-time bound.
	CreatedTo   *time.Time // Optional inclusive upper creation-time bound.
	Limit       int        // Maximum results; nonpositive means unlimited.
}

ListRequest configures the three session-list filters.

type QueryService

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

QueryService finds sessions by title, time, or keyword.

func New

func New(store *sqlstore.Store) *QueryService

New binds a query service to the S03 SQLite session store.

func (*QueryService) ListSummaries

func (q *QueryService) ListSummaries(ctx context.Context, req ListRequest) ([]SessionSummary, error)

ListSummaries filters by title prefix and creation range, ordered by latest update first.

func (*QueryService) Search

func (q *QueryService) Search(ctx context.Context, req SearchRequest) ([]SessionSummary, error)

Search returns summaries for the union of FTS5 content hits and title-substring matches.

type SearchRequest

type SearchRequest struct {
	Keyword string // Nonempty search keyword.
	Limit   int    // Maximum results.
}

SearchRequest configures full-text search.

type SessionSummary

type SessionSummary struct {
	ID         string    `json:"id"`
	Title      string    `json:"title"`
	CreatedAt  time.Time `json:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt"`
	EventCount int       `json:"eventCount"`
}

SessionSummary is a queryable session summary.

Jump to

Keyboard shortcuts

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