Documentation
¶
Index ¶
- type Annotation
- type BumpIndexSeqParams
- type ChatSpentTodayRow
- type ChatUsageParams
- type ChatUsageRow
- type ChunkToSearchRow
- type CountAnnotationsParams
- type CountDocumentChunksParams
- type CountRunningAnswersParams
- type CreateAnnotationParams
- type CreateConversationParams
- type CreateDocumentIfAbsentParams
- type CreateDocumentIfAbsentRow
- type CreateIdentityParams
- type CreateImportParams
- type CreatePDFImportParams
- type CreateSessionParams
- type CreateUserParams
- type DBTX
- type DeleteAnnotationParams
- type DeleteAnnotationRow
- type DeleteConversationParams
- type DeleteDocumentChunksParams
- type DeleteDocumentConversationsParams
- type DeleteDocumentParams
- type DeletePDFSourceParams
- type DocumentExtractionParams
- type DocumentOriginalParams
- type DocumentOriginalRow
- type DocumentVersionParams
- type DocumentsBehindParams
- type DocumentsBehindRow
- type FailImportParams
- type FindOwnerDocumentForURLParams
- type FindOwnerPDFDocumentParams
- type FindSourceForURLRow
- type FinishImportParams
- type FinishMessageParams
- type FinishMessageRow
- type GetAccountParams
- type GetAccountRow
- type GetAnnotationParams
- type GetCachedEmbeddingsParams
- type GetCachedEmbeddingsRow
- type GetConversationParams
- type GetConversationRow
- type GetDocumentParams
- type GetDocumentRow
- type GetIdentityParams
- type GetImportParams
- type GetIndexStateParams
- type GetIndexStateRow
- type GetSessionParams
- type GetSessionRow
- type Import
- type InsertChunkParams
- type InsertMessageParams
- type InsertMessageRow
- type LatestImportForDocumentParams
- type ListAnnotationsParams
- type ListConversationsParams
- type ListConversationsRow
- type ListDocumentsParams
- type ListDocumentsRow
- type ListMessagesParams
- type ListMessagesRow
- type LockConversationParams
- type LockDocumentContentParams
- type MarkIndexedParams
- type NewestSnapshotRow
- type PutCachedEmbeddingParams
- type Queries
- func (q *Queries) BlobKeysInUse(ctx context.Context, keys []string) ([]string, error)
- func (q *Queries) BumpIndexSeq(ctx context.Context, arg BumpIndexSeqParams) (int64, error)
- func (q *Queries) ChatSpentToday(ctx context.Context) (ChatSpentTodayRow, error)
- func (q *Queries) ChatUsage(ctx context.Context, arg ChatUsageParams) (ChatUsageRow, error)
- func (q *Queries) ChunkToSearch(ctx context.Context) (ChunkToSearchRow, error)
- func (q *Queries) CountAnnotations(ctx context.Context, arg CountAnnotationsParams) (int64, error)
- func (q *Queries) CountDocumentChunks(ctx context.Context, arg CountDocumentChunksParams) (int32, error)
- func (q *Queries) CountRunningAnswers(ctx context.Context, arg CountRunningAnswersParams) (int32, error)
- func (q *Queries) CreateAnnotation(ctx context.Context, arg CreateAnnotationParams) (Annotation, error)
- func (q *Queries) CreateConversation(ctx context.Context, arg CreateConversationParams) (uuid.UUID, error)
- func (q *Queries) CreateDocumentIfAbsent(ctx context.Context, arg CreateDocumentIfAbsentParams) (CreateDocumentIfAbsentRow, error)
- func (q *Queries) CreateIdentity(ctx context.Context, arg CreateIdentityParams) error
- func (q *Queries) CreateImport(ctx context.Context, arg CreateImportParams) (Import, error)
- func (q *Queries) CreatePDFImport(ctx context.Context, arg CreatePDFImportParams) (Import, error)
- func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) error
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
- func (q *Queries) DeleteAnnotation(ctx context.Context, arg DeleteAnnotationParams) (DeleteAnnotationRow, error)
- func (q *Queries) DeleteConversation(ctx context.Context, arg DeleteConversationParams) (int64, error)
- func (q *Queries) DeleteDocument(ctx context.Context, arg DeleteDocumentParams) (uuid.UUID, error)
- func (q *Queries) DeleteDocumentChunks(ctx context.Context, arg DeleteDocumentChunksParams) error
- func (q *Queries) DeleteDocumentConversations(ctx context.Context, arg DeleteDocumentConversationsParams) ([]uuid.UUID, error)
- func (q *Queries) DeletePDFSource(ctx context.Context, arg DeletePDFSourceParams) ([]string, error)
- func (q *Queries) DeleteSession(ctx context.Context, tokenHash []byte) error
- func (q *Queries) DeleteUser(ctx context.Context, id uuid.UUID) (int64, error)
- func (q *Queries) DeleteUserSessions(ctx context.Context, userID uuid.UUID) error
- func (q *Queries) DocumentExtraction(ctx context.Context, arg DocumentExtractionParams) ([]byte, error)
- func (q *Queries) DocumentOriginal(ctx context.Context, arg DocumentOriginalParams) (DocumentOriginalRow, error)
- func (q *Queries) DocumentVersion(ctx context.Context, arg DocumentVersionParams) (int32, error)
- func (q *Queries) DocumentsBehind(ctx context.Context, arg DocumentsBehindParams) ([]DocumentsBehindRow, error)
- func (q *Queries) FailImport(ctx context.Context, arg FailImportParams) (Import, error)
- func (q *Queries) FindOwnerDocumentForURL(ctx context.Context, arg FindOwnerDocumentForURLParams) (uuid.UUID, error)
- func (q *Queries) FindOwnerPDFDocument(ctx context.Context, arg FindOwnerPDFDocumentParams) (uuid.UUID, error)
- func (q *Queries) FindSourceForURL(ctx context.Context, url string) (FindSourceForURLRow, error)
- func (q *Queries) FinishImport(ctx context.Context, arg FinishImportParams) (Import, error)
- func (q *Queries) FinishMessage(ctx context.Context, arg FinishMessageParams) (FinishMessageRow, error)
- func (q *Queries) GetAccount(ctx context.Context, arg GetAccountParams) (GetAccountRow, error)
- func (q *Queries) GetAnnotation(ctx context.Context, arg GetAnnotationParams) (Annotation, error)
- func (q *Queries) GetCachedEmbeddings(ctx context.Context, arg GetCachedEmbeddingsParams) ([]GetCachedEmbeddingsRow, error)
- func (q *Queries) GetConversation(ctx context.Context, arg GetConversationParams) (GetConversationRow, error)
- func (q *Queries) GetDocument(ctx context.Context, arg GetDocumentParams) (GetDocumentRow, error)
- func (q *Queries) GetIdentity(ctx context.Context, arg GetIdentityParams) (UserIdentity, error)
- func (q *Queries) GetImport(ctx context.Context, arg GetImportParams) (Import, error)
- func (q *Queries) GetIndexState(ctx context.Context, arg GetIndexStateParams) (GetIndexStateRow, error)
- func (q *Queries) GetSession(ctx context.Context, arg GetSessionParams) (GetSessionRow, error)
- func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error)
- func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)
- func (q *Queries) InsertChunk(ctx context.Context, arg InsertChunkParams) error
- func (q *Queries) InsertMessage(ctx context.Context, arg InsertMessageParams) (InsertMessageRow, error)
- func (q *Queries) LatestImportForDocument(ctx context.Context, arg LatestImportForDocumentParams) (Import, error)
- func (q *Queries) ListAnnotations(ctx context.Context, arg ListAnnotationsParams) ([]Annotation, error)
- func (q *Queries) ListConversations(ctx context.Context, arg ListConversationsParams) ([]ListConversationsRow, error)
- func (q *Queries) ListDocuments(ctx context.Context, arg ListDocumentsParams) ([]ListDocumentsRow, error)
- func (q *Queries) ListMessages(ctx context.Context, arg ListMessagesParams) ([]ListMessagesRow, error)
- func (q *Queries) LockConversation(ctx context.Context, arg LockConversationParams) (uuid.UUID, error)
- func (q *Queries) LockDocumentContent(ctx context.Context, arg LockDocumentContentParams) ([]byte, error)
- func (q *Queries) LockOwner(ctx context.Context, ownerID uuid.UUID) error
- func (q *Queries) MarkIndexed(ctx context.Context, arg MarkIndexedParams) error
- func (q *Queries) NewestSnapshot(ctx context.Context, sourceID uuid.UUID) (NewestSnapshotRow, error)
- func (q *Queries) PutCachedEmbedding(ctx context.Context, arg PutCachedEmbeddingParams) error
- func (q *Queries) QuotaUsage(ctx context.Context, arg QuotaUsageParams) (QuotaUsageRow, error)
- func (q *Queries) ResolveDocuments(ctx context.Context, arg ResolveDocumentsParams) ([]ResolveDocumentsRow, error)
- func (q *Queries) SaveDocument(ctx context.Context, arg SaveDocumentParams) (int32, error)
- func (q *Queries) SaveExtraction(ctx context.Context, arg SaveExtractionParams) (SaveExtractionRow, error)
- func (q *Queries) SavePDFSnapshot(ctx context.Context, arg SavePDFSnapshotParams) (uuid.UUID, error)
- func (q *Queries) SaveSnapshot(ctx context.Context, arg SaveSnapshotParams) (uuid.UUID, error)
- func (q *Queries) SearchChunks(ctx context.Context, arg SearchChunksParams) ([]SearchChunksRow, error)
- func (q *Queries) SetIdentityLogin(ctx context.Context, arg SetIdentityLoginParams) error
- func (q *Queries) SetImportPDFPages(ctx context.Context, arg SetImportPDFPagesParams) error
- func (q *Queries) SetImportStatus(ctx context.Context, arg SetImportStatusParams) (Import, error)
- func (q *Queries) TouchConversation(ctx context.Context, arg TouchConversationParams) error
- func (q *Queries) TouchSession(ctx context.Context, tokenHash []byte) error
- func (q *Queries) TouchSource(ctx context.Context, arg TouchSourceParams) error
- func (q *Queries) UpdateAnnotation(ctx context.Context, arg UpdateAnnotationParams) (Annotation, error)
- func (q *Queries) UpsertPDFSource(ctx context.Context, arg UpsertPDFSourceParams) (uuid.UUID, error)
- func (q *Queries) UpsertSource(ctx context.Context, arg UpsertSourceParams) (UpsertSourceRow, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type QuotaUsageParams
- type QuotaUsageRow
- type ResolveDocumentsParams
- type ResolveDocumentsRow
- type SaveDocumentParams
- type SaveExtractionParams
- type SaveExtractionRow
- type SavePDFSnapshotParams
- type SaveSnapshotParams
- type SearchChunksParams
- type SearchChunksRow
- type SetIdentityLoginParams
- type SetImportPDFPagesParams
- type SetImportStatusParams
- type TouchConversationParams
- type TouchSourceParams
- type UpdateAnnotationParams
- type UpsertPDFSourceParams
- type UpsertSourceParams
- type UpsertSourceRow
- type User
- type UserIdentity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type ChatSpentTodayRow ¶
type ChatUsageParams ¶
type ChatUsageRow ¶
type ChunkToSearchRow ¶
type CountAnnotationsParams ¶
type CreateAnnotationParams ¶
type CreateIdentityParams ¶
type CreateImportParams ¶
type CreatePDFImportParams ¶
type CreateSessionParams ¶
type CreateUserParams ¶
type DeleteAnnotationRow ¶
type DeletePDFSourceParams ¶
type DocumentOriginalRow ¶
type DocumentsBehindParams ¶
type DocumentsBehindRow ¶
type FailImportParams ¶
type FindSourceForURLRow ¶
type FinishImportParams ¶
type FinishMessageParams ¶
type FinishMessageParams struct {
Status string
Content []byte
Model string
InputTokens int32
OutputTokens int32
CacheCreationInputTokens int32
CacheReadInputTokens int32
CostMicrousd int64
FirstTokenMs int32
LatencyMs int32
ToolRounds int32
InvalidCitations int32
SelfMarkers int32
OwnerID uuid.UUID
ID uuid.UUID
}
type FinishMessageRow ¶
type FinishMessageRow struct {
ID uuid.UUID
ConversationID uuid.UUID
Role string
Status string
Content []byte
Model string
InputTokens int32
OutputTokens int32
CacheCreationInputTokens int32
CacheReadInputTokens int32
CostMicrousd int64
FirstTokenMs int32
LatencyMs int32
ToolRounds int32
InvalidCitations int32
SelfMarkers int32
CreatedAt time.Time
}
type GetAccountParams ¶
type GetAccountRow ¶
type GetCachedEmbeddingsRow ¶
type GetCachedEmbeddingsRow struct {
TextSha256 []byte
Embedding pgvector.HalfVector
}
type GetConversationRow ¶
type GetDocumentRow ¶
type GetIdentityParams ¶
type GetIndexStateRow ¶
type GetSessionParams ¶
type InsertChunkParams ¶
type InsertMessageParams ¶
type InsertMessageRow ¶
type InsertMessageRow struct {
ID uuid.UUID
ConversationID uuid.UUID
Role string
Status string
Content []byte
Model string
InputTokens int32
OutputTokens int32
CacheCreationInputTokens int32
CacheReadInputTokens int32
CostMicrousd int64
FirstTokenMs int32
LatencyMs int32
ToolRounds int32
InvalidCitations int32
SelfMarkers int32
CreatedAt time.Time
}
type ListAnnotationsParams ¶
type ListConversationsParams ¶
type ListConversationsRow ¶
type ListDocumentsParams ¶
type ListDocumentsRow ¶
type ListMessagesParams ¶
type ListMessagesRow ¶
type ListMessagesRow struct {
ID uuid.UUID
ConversationID uuid.UUID
Role string
Status string
Content []byte
Model string
InputTokens int32
OutputTokens int32
CacheCreationInputTokens int32
CacheReadInputTokens int32
CostMicrousd int64
FirstTokenMs int32
LatencyMs int32
ToolRounds int32
InvalidCitations int32
SelfMarkers int32
CreatedAt time.Time
}
type NewestSnapshotRow ¶
type PutCachedEmbeddingParams ¶
type PutCachedEmbeddingParams struct {
Model string
TextSha256 []byte
Embedding pgvector.HalfVector
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) BlobKeysInUse ¶
The keys among keys that a PDF snapshot holds, or that an unfinished PDF import of its owner will read.
func (*Queries) BumpIndexSeq ¶
Records a change search sees; the new sequence keys the index job.
func (*Queries) ChatSpentToday ¶
func (q *Queries) ChatSpentToday(ctx context.Context) (ChatSpentTodayRow, error)
What every user's answers have cost since midnight UTC, and how long until the next one.
func (*Queries) ChatUsage ¶
func (q *Queries) ChatUsage(ctx context.Context, arg ChatUsageParams) (ChatUsageRow, error)
What counts against the owner's chat quotas within the window: questions asked, and the input tokens their answers read, with how long until the oldest of each leaves the window.
func (*Queries) ChunkToSearch ¶
func (q *Queries) ChunkToSearch(ctx context.Context) (ChunkToSearchRow, error)
The restore drill's search (docs/adr/0015-operations.md): the newest chunk's owner and a word it is indexed by, which it searches its owner's library for. The word is one of its lexemes, which full-text search kept, so never a stopword; the longest, as the most particular.
func (*Queries) CountAnnotations ¶
func (*Queries) CountDocumentChunks ¶
func (*Queries) CountRunningAnswers ¶
func (q *Queries) CountRunningAnswers(ctx context.Context, arg CountRunningAnswersParams) (int32, error)
Answers in the conversation still streaming, unless they have been for longer than any answer runs.
func (*Queries) CreateAnnotation ¶
func (q *Queries) CreateAnnotation(ctx context.Context, arg CreateAnnotationParams) (Annotation, error)
func (*Queries) CreateConversation ¶
func (q *Queries) CreateConversation(ctx context.Context, arg CreateConversationParams) (uuid.UUID, error)
Every query here is scoped by owner_id; TestOwnedQueriesAreScoped checks it. The owner's new conversation, about document when it is theirs, else over their library. No row when document isn't the owner's.
func (*Queries) CreateDocumentIfAbsent ¶
func (q *Queries) CreateDocumentIfAbsent(ctx context.Context, arg CreateDocumentIfAbsentParams) (CreateDocumentIfAbsentRow, error)
Creates the owner's document for a source, or returns the one they already have. created is false when it already existed.
func (*Queries) CreateIdentity ¶
func (q *Queries) CreateIdentity(ctx context.Context, arg CreateIdentityParams) error
func (*Queries) CreateImport ¶
Every query here is scoped by owner_id; TestOwnedQueriesAreScoped checks it.
func (*Queries) CreatePDFImport ¶
func (*Queries) CreateSession ¶
func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) error
func (*Queries) CreateUser ¶
func (*Queries) DeleteAnnotation ¶
func (q *Queries) DeleteAnnotation(ctx context.Context, arg DeleteAnnotationParams) (DeleteAnnotationRow, error)
func (*Queries) DeleteConversation ¶
func (*Queries) DeleteDocument ¶
Deletes the owner's document; its annotations and chunks go with it, and the imports that made it keep their row without it. Returns its source.
func (*Queries) DeleteDocumentChunks ¶
func (q *Queries) DeleteDocumentChunks(ctx context.Context, arg DeleteDocumentChunksParams) error
Every query on chunks is scoped by owner_id; TestOwnedQueriesAreScoped checks it.
func (*Queries) DeleteDocumentConversations ¶
func (q *Queries) DeleteDocumentConversations(ctx context.Context, arg DeleteDocumentConversationsParams) ([]uuid.UUID, error)
Deletes the conversations about the owner's document, before the document itself, and names them so their answers can be stopped.
func (*Queries) DeletePDFSource ¶
Deletes the owner's PDF source once no document of theirs uses it, with its snapshots and extractions, and returns its snapshots' blob keys.
func (*Queries) DeleteSession ¶
func (*Queries) DeleteUser ¶
Everything the user owns goes with them; shared sources stay.
func (*Queries) DeleteUserSessions ¶
func (*Queries) DocumentExtraction ¶
func (q *Queries) DocumentExtraction(ctx context.Context, arg DocumentExtractionParams) ([]byte, error)
The IR of the extraction the owner's document was made from.
func (*Queries) DocumentOriginal ¶
func (q *Queries) DocumentOriginal(ctx context.Context, arg DocumentOriginalParams) (DocumentOriginalRow, error)
The blob key and filename of the PDF the owner's document was made from.
func (*Queries) DocumentVersion ¶
func (*Queries) DocumentsBehind ¶
func (q *Queries) DocumentsBehind(ctx context.Context, arg DocumentsBehindParams) ([]DocumentsBehindRow, error)
Every user's documents whose chunks are behind their content, or were embedded by another model: the worker's backfill, across owners.
func (*Queries) FailImport ¶
Marks an import that has not finished as failed with a stable error code.
func (*Queries) FindOwnerDocumentForURL ¶
func (q *Queries) FindOwnerDocumentForURL(ctx context.Context, arg FindOwnerDocumentForURLParams) (uuid.UUID, error)
Every query here is scoped by owner_id; TestOwnedQueriesAreScoped checks it. The owner's document for url: a document whose source has url as its canonical or final URL, or one an earlier import of url produced.
func (*Queries) FindOwnerPDFDocument ¶
func (q *Queries) FindOwnerPDFDocument(ctx context.Context, arg FindOwnerPDFDocumentParams) (uuid.UUID, error)
The owner's document made from the PDF with this SHA-256.
func (*Queries) FindSourceForURL ¶
The web source whose canonical URL, or else whose final URL, is url.
func (*Queries) FinishImport ¶
Marks an import done with its document. Finishing it again with the same document changes nothing; a failed import stays failed.
func (*Queries) FinishMessage ¶
func (q *Queries) FinishMessage(ctx context.Context, arg FinishMessageParams) (FinishMessageRow, error)
Ends a streaming answer with what it said and what it cost.
func (*Queries) GetAccount ¶
func (q *Queries) GetAccount(ctx context.Context, arg GetAccountParams) (GetAccountRow, error)
func (*Queries) GetAnnotation ¶
func (q *Queries) GetAnnotation(ctx context.Context, arg GetAnnotationParams) (Annotation, error)
func (*Queries) GetCachedEmbeddings ¶
func (q *Queries) GetCachedEmbeddings(ctx context.Context, arg GetCachedEmbeddingsParams) ([]GetCachedEmbeddingsRow, error)
func (*Queries) GetConversation ¶
func (q *Queries) GetConversation(ctx context.Context, arg GetConversationParams) (GetConversationRow, error)
func (*Queries) GetDocument ¶
func (q *Queries) GetDocument(ctx context.Context, arg GetDocumentParams) (GetDocumentRow, error)
The document, with the warnings of the extraction it was made from. A web page's source is its URL; a PDF's, its file (source.pdf in the IR).
func (*Queries) GetIdentity ¶
func (q *Queries) GetIdentity(ctx context.Context, arg GetIdentityParams) (UserIdentity, error)
func (*Queries) GetIndexState ¶
func (q *Queries) GetIndexState(ctx context.Context, arg GetIndexStateParams) (GetIndexStateRow, error)
func (*Queries) GetSession ¶
func (q *Queries) GetSession(ctx context.Context, arg GetSessionParams) (GetSessionRow, error)
A session past its absolute limit, or unused for longer than the idle limit, is no session. Stale says its last use is older than touch_seconds, by the database's clock, which wrote it.
func (*Queries) GetUserByEmail ¶
func (*Queries) InsertChunk ¶
func (q *Queries) InsertChunk(ctx context.Context, arg InsertChunkParams) error
Headings and prose are read as English, code as it is; idents is a tsvector literal of the identifier tokens, weighted A.
func (*Queries) InsertMessage ¶
func (q *Queries) InsertMessage(ctx context.Context, arg InsertMessageParams) (InsertMessageRow, error)
func (*Queries) LatestImportForDocument ¶
func (*Queries) ListAnnotations ¶
func (q *Queries) ListAnnotations(ctx context.Context, arg ListAnnotationsParams) ([]Annotation, error)
Every query here is scoped by owner_id; TestOwnedQueriesAreScoped checks it.
func (*Queries) ListConversations ¶
func (q *Queries) ListConversations(ctx context.Context, arg ListConversationsParams) ([]ListConversationsRow, error)
The owner's conversations, most recently active first, after the (updated_at, id) cursor.
func (*Queries) ListDocuments ¶
func (q *Queries) ListDocuments(ctx context.Context, arg ListDocumentsParams) ([]ListDocumentsRow, error)
The owner's documents, newest first, after the (created_at, id) cursor.
func (*Queries) ListMessages ¶
func (q *Queries) ListMessages(ctx context.Context, arg ListMessagesParams) ([]ListMessagesRow, error)
A conversation's messages in order. An answer still streaming after longer than any answer runs failed with its process.
func (*Queries) LockConversation ¶
func (q *Queries) LockConversation(ctx context.Context, arg LockConversationParams) (uuid.UUID, error)
Holds the conversation until the transaction ends, so two answers can't both start in it.
func (*Queries) LockDocumentContent ¶
func (q *Queries) LockDocumentContent(ctx context.Context, arg LockDocumentContentParams) ([]byte, error)
The document's content, locked until the transaction ends, so annotations are checked against the text a save cannot change meanwhile.
func (*Queries) LockOwner ¶
Holds the owner's quota lock until the transaction ends, so two imports can't both pass a check that only one fits under.
func (*Queries) MarkIndexed ¶
func (q *Queries) MarkIndexed(ctx context.Context, arg MarkIndexedParams) error
func (*Queries) NewestSnapshot ¶
func (q *Queries) NewestSnapshot(ctx context.Context, sourceID uuid.UUID) (NewestSnapshotRow, error)
The newest snapshot of a web source, whose body Postgres holds.
func (*Queries) PutCachedEmbedding ¶
func (q *Queries) PutCachedEmbedding(ctx context.Context, arg PutCachedEmbeddingParams) error
func (*Queries) QuotaUsage ¶
func (q *Queries) QuotaUsage(ctx context.Context, arg QuotaUsageParams) (QuotaUsageRow, error)
What counts against the owner's quotas: imports started within the window and how many seconds until the oldest of them leaves it; and documents, with the imports still under way, which may each make one.
func (*Queries) ResolveDocuments ¶
func (q *Queries) ResolveDocuments(ctx context.Context, arg ResolveDocumentsParams) ([]ResolveDocumentsRow, error)
For each canonical URL, the owner's document for it, matched as FindOwnerDocumentForURL matches one URL. URLs without one are left out.
func (*Queries) SaveDocument ¶
Replaces the content if the document is still at version, and bumps it.
func (*Queries) SaveExtraction ¶
func (q *Queries) SaveExtraction(ctx context.Context, arg SaveExtractionParams) (SaveExtractionRow, error)
Inserts an extraction, or returns the stored one for the same snapshot and extractor version, with its IR.
func (*Queries) SavePDFSnapshot ¶
func (q *Queries) SavePDFSnapshot(ctx context.Context, arg SavePDFSnapshotParams) (uuid.UUID, error)
The snapshot of a PDF source: its blob, not its body. The no-op update makes RETURNING see an existing row.
func (*Queries) SaveSnapshot ¶
Inserts a snapshot, or returns the one the source already has with the same body. The no-op update makes RETURNING see that row.
func (*Queries) SearchChunks ¶
func (q *Queries) SearchChunks(ctx context.Context, arg SearchChunksParams) ([]SearchChunksRow, error)
Every query on chunks is scoped by owner_id; TestOwnedQueriesAreScoped checks it. Hybrid search over one user's chunks (docs/adr/0011-retrieval.md): the top 50 by words and the top 50 by meaning, each read through the owner's rows alone, merged by reciprocal rank fusion. A null query vector leaves the meaning half out; use_words false leaves the words half out.
Chunks that tie, as the copies of one page in two documents do, are ordered by document, oldest first (ids are UUIDv7), then by place in the document, in every ranking and the last one. Not by chunk id: indexing a document again makes new ones, which would put its chunks after another document's. So the order never rests on the query plan or on an edit (docs/adr/0011-retrieval.md).
func (*Queries) SetIdentityLogin ¶
func (q *Queries) SetIdentityLogin(ctx context.Context, arg SetIdentityLoginParams) error
func (*Queries) SetImportPDFPages ¶
func (q *Queries) SetImportPDFPages(ctx context.Context, arg SetImportPDFPagesParams) error
Records the page count pdftext read in a PDF import's file.
func (*Queries) SetImportStatus ¶
Moves an import that has not finished to a working status.
func (*Queries) TouchConversation ¶
func (q *Queries) TouchConversation(ctx context.Context, arg TouchConversationParams) error
Marks the conversation active now, and titles it with its first question.
func (*Queries) TouchSession ¶
func (*Queries) TouchSource ¶
func (q *Queries) TouchSource(ctx context.Context, arg TouchSourceParams) error
func (*Queries) UpdateAnnotation ¶
func (q *Queries) UpdateAnnotation(ctx context.Context, arg UpdateAnnotationParams) (Annotation, error)
Replaces block, selector and note if the annotation is still at version, and bumps it.
func (*Queries) UpsertPDFSource ¶
func (q *Queries) UpsertPDFSource(ctx context.Context, arg UpsertPDFSourceParams) (uuid.UUID, error)
The owner's source for the PDF with this SHA-256, created the first time. A PDF's source is never shared (docs/adr/0013-pdf-import.md).
func (*Queries) UpsertSource ¶
func (q *Queries) UpsertSource(ctx context.Context, arg UpsertSourceParams) (UpsertSourceRow, error)