MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / hasSessionIndex

Function hasSessionIndex

packages/core/src/query/session-queries.ts:391–399  ·  view source on GitHub ↗
(db: DatabaseAdapter)

Source from the content-addressed store, hash-verified

389 * Check whether the segment table exists and has at least one row.
390 */
391export function hasSessionIndex(db: DatabaseAdapter): boolean {
392 if (!hasTable(db, 'segment')) return false
393 try {
394 const row = db.prepare('SELECT COUNT(*) as count FROM segment').get() as { count: number } | undefined
395 return (row?.count ?? 0) > 0
396 } catch {
397 return false
398 }
399}
400
401/**
402 * Session index statistics: count, existence flag, and gap threshold from meta.

Callers 1

Calls 3

hasTableFunction · 0.90
getMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected