Documentation
¶
Index ¶
- Constants
- Variables
- func Float32ToBlob(v []float32) []byte
- type Page
- type Source
- type Store
- func (s *Store) Close() error
- func (s *Store) DB() *sql.DB
- func (s *Store) DeleteSource(id int64) error
- func (s *Store) DeleteToken(sourceID int64, provider string) error
- func (s *Store) GetPageByURL(url string) (*Page, error)
- func (s *Store) GetSource(id int64) (*Source, error)
- func (s *Store) GetSourceIDByName(name string) (int64, error)
- func (s *Store) GetToken(sourceID int64, provider string) ([]byte, error)
- func (s *Store) InsertSource(src Source) (int64, error)
- func (s *Store) ListSources() ([]Source, error)
- func (s *Store) UpdateSourceConfig(id int64, src Source) error
- func (s *Store) UpdateSourceCrawlTotal(id int64, total int) error
- func (s *Store) UpdateSourcePageCount(id int64, count int) error
- func (s *Store) UpsertEmbedding(pageID int64, embedding []float32) error
- func (s *Store) UpsertPage(p Page) (int64, error)
- func (s *Store) UpsertSourceConfigByName(src Source) (int64, error)
- func (s *Store) UpsertToken(sourceID int64, provider string, data []byte, expiresAt time.Time) error
Constants ¶
const ( SourceOriginUI = "ui" SourceOriginConfig = "config" )
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a requested record does not exist.
Functions ¶
func Float32ToBlob ¶
Float32ToBlob serialises a float32 slice as little-endian bytes for sqlite-vec. Exported so the search package can use it for query vectors too.
Types ¶
type Source ¶
type Source struct {
ID int64
Name string
Type string
URL string
Repo string
Branch string
BaseURL string
SpaceKey string
Auth string `json:"-"`
CrawlSchedule string
LastCrawled *time.Time
PageCount int
CrawlTotal int
IncludePath string
IncludePaths []string
Origin string
}
Source represents a configured documentation source.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps a SQLite database and exposes DocuMcp data operations.
func (*Store) DB ¶
DB returns the underlying *sql.DB for packages that need direct access (e.g. search).
func (*Store) DeleteSource ¶
DeleteSource deletes a source and all its pages (cascade).
func (*Store) DeleteToken ¶
DeleteToken removes the stored token for the given source+provider pair. Returns nil if the token did not exist.
func (*Store) GetPageByURL ¶
GetPageByURL returns a page by its URL.
func (*Store) GetSourceIDByName ¶
GetSourceIDByName returns the ID of a source with the given name.
func (*Store) GetToken ¶
GetToken retrieves encrypted token data for a source+provider pair. Returns ErrNotFound if no token exists for the given source+provider.
func (*Store) InsertSource ¶
InsertSource inserts a new source and returns its ID.
func (*Store) ListSources ¶
ListSources returns all configured sources.
func (*Store) UpdateSourceConfig ¶ added in v0.1.4
UpdateSourceConfig updates editable source configuration fields. It intentionally leaves type, auth, crawl progress, and timestamps unchanged.
func (*Store) UpdateSourceCrawlTotal ¶
UpdateSourceCrawlTotal sets the total number of URLs discovered for a crawl run.
func (*Store) UpdateSourcePageCount ¶
UpdateSourcePageCount updates the page_count for a source.
func (*Store) UpsertEmbedding ¶
UpsertEmbedding inserts or replaces the embedding vector for a page. sqlite-vec vec0 virtual tables do not support INSERT OR REPLACE, so we delete any existing row first and then insert.
func (*Store) UpsertPage ¶
UpsertPage inserts or updates a page by URL and returns the page's row ID.
func (*Store) UpsertSourceConfigByName ¶ added in v0.1.5
UpsertSourceConfigByName inserts or updates a source declared in config.yaml. It preserves crawl progress and timestamps for existing sources with the same name.