db

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CountDocumentsCols = struct {
	N metaquery.IntCol
}{
	N: metaquery.NewIntCol("n"),
}

CountDocumentsCols gives typed, name-safe access to CountDocuments's output columns.

View Source
var CountFragmentsCols = struct {
	N metaquery.IntCol
}{
	N: metaquery.NewIntCol("n"),
}

CountFragmentsCols gives typed, name-safe access to CountFragments's output columns.

View Source
var EnqueueJobCols = struct {
	ID metaquery.IntCol
}{
	ID: metaquery.NewIntCol("id"),
}

EnqueueJobCols gives typed, name-safe access to EnqueueJob's output columns.

View Source
var ExportFragmentsCols = struct {
	Page      metaquery.IntCol
	Ord       metaquery.IntCol
	Text      metaquery.TextCol
	StartOff  metaquery.IntCol
	EndOff    metaquery.IntCol
	PageSpans metaquery.TextCol
	Vec       metaquery.BytesCol
}{
	Page:      metaquery.NewIntCol("page"),
	Ord:       metaquery.NewIntCol("ord"),
	Text:      metaquery.NewTextCol("text"),
	StartOff:  metaquery.NewIntCol("start_off"),
	EndOff:    metaquery.NewIntCol("end_off"),
	PageSpans: metaquery.NewTextCol("page_spans"),
	Vec:       metaquery.NewBytesCol("vec"),
}

ExportFragmentsCols gives typed, name-safe access to ExportFragments's output columns.

View Source
var FindPathByHashCols = struct {
	Path metaquery.TextCol
}{
	Path: metaquery.NewTextCol("path"),
}

FindPathByHashCols gives typed, name-safe access to FindPathByHash's output columns.

View Source
var GetDocumentByPathCols = struct {
	ID      metaquery.IntCol
	Path    metaquery.TextCol
	Title   metaquery.TextCol
	AddedAt metaquery.IntCol
}{
	ID:      metaquery.NewIntCol("id"),
	Path:    metaquery.NewTextCol("path"),
	Title:   metaquery.NewTextCol("title"),
	AddedAt: metaquery.NewIntCol("added_at"),
}

GetDocumentByPathCols gives typed, name-safe access to GetDocumentByPath's output columns.

View Source
var GetDocumentFragCols = struct {
	FragMode   metaquery.TextCol
	FragRecipe metaquery.TextCol
}{
	FragMode:   metaquery.NewTextCol("frag_mode"),
	FragRecipe: metaquery.NewTextCol("frag_recipe"),
}

GetDocumentFragCols gives typed, name-safe access to GetDocumentFrag's output columns.

View Source
var GetDocumentHashCols = struct {
	ContentHash metaquery.TextCol
}{
	ContentHash: metaquery.NewTextCol("content_hash"),
}

GetDocumentHashCols gives typed, name-safe access to GetDocumentHash's output columns.

View Source
var GetJobCols = struct {
	ID         metaquery.IntCol
	Url        metaquery.TextCol
	Title      metaquery.TextCol
	State      metaquery.TextCol
	Error      metaquery.TextCol
	Fragments  metaquery.IntCol
	Mode       metaquery.TextCol
	EnqueuedAt metaquery.IntCol
	StartedAt  metaquery.IntCol
	FinishedAt metaquery.IntCol
	OwnerPid   metaquery.IntCol
	Lane       metaquery.TextCol
}{
	ID:         metaquery.NewIntCol("id"),
	Url:        metaquery.NewTextCol("url"),
	Title:      metaquery.NewTextCol("title"),
	State:      metaquery.NewTextCol("state"),
	Error:      metaquery.NewTextCol("error"),
	Fragments:  metaquery.NewIntCol("fragments"),
	Mode:       metaquery.NewTextCol("mode"),
	EnqueuedAt: metaquery.NewIntCol("enqueued_at"),
	StartedAt:  metaquery.NewIntCol("started_at"),
	FinishedAt: metaquery.NewIntCol("finished_at"),
	OwnerPid:   metaquery.NewIntCol("owner_pid"),
	Lane:       metaquery.NewTextCol("lane"),
}

GetJobCols gives typed, name-safe access to GetJob's output columns.

View Source
var GetOldestPendingJobCols = struct {
	ID         metaquery.IntCol
	Url        metaquery.TextCol
	Title      metaquery.TextCol
	EnqueuedAt metaquery.IntCol
}{
	ID:         metaquery.NewIntCol("id"),
	Url:        metaquery.NewTextCol("url"),
	Title:      metaquery.NewTextCol("title"),
	EnqueuedAt: metaquery.NewIntCol("enqueued_at"),
}

GetOldestPendingJobCols gives typed, name-safe access to GetOldestPendingJob's output columns.

View Source
var GetOldestPendingJobInLaneCols = struct {
	ID         metaquery.IntCol
	Url        metaquery.TextCol
	Title      metaquery.TextCol
	EnqueuedAt metaquery.IntCol
}{
	ID:         metaquery.NewIntCol("id"),
	Url:        metaquery.NewTextCol("url"),
	Title:      metaquery.NewTextCol("title"),
	EnqueuedAt: metaquery.NewIntCol("enqueued_at"),
}

GetOldestPendingJobInLaneCols gives typed, name-safe access to GetOldestPendingJobInLane's output columns.

View Source
var GetPageImagePathCols = struct {
	ImagePath metaquery.TextCol
}{
	ImagePath: metaquery.NewTextCol("image_path"),
}

GetPageImagePathCols gives typed, name-safe access to GetPageImagePath's output columns.

View Source
var GetReadingForDocCols = struct {
	ID           metaquery.IntCol
	SourceSha256 metaquery.TextCol
	SourcePath   metaquery.TextCol
	DocPath      metaquery.TextCol
	Method       metaquery.TextCol
	Level        metaquery.TextCol
	ProducedBy   metaquery.TextCol
	RuledBy      metaquery.TextCol
	At           metaquery.IntCol
	Text         metaquery.TextCol
	Data         metaquery.TextCol
	Ruled        metaquery.TextCol
	Describes    metaquery.IntCol
	DescribedPct metaquery.IntCol
}{
	ID:           metaquery.NewIntCol("id"),
	SourceSha256: metaquery.NewTextCol("source_sha256"),
	SourcePath:   metaquery.NewTextCol("source_path"),
	DocPath:      metaquery.NewTextCol("doc_path"),
	Method:       metaquery.NewTextCol("method"),
	Level:        metaquery.NewTextCol("level"),
	ProducedBy:   metaquery.NewTextCol("produced_by"),
	RuledBy:      metaquery.NewTextCol("ruled_by"),
	At:           metaquery.NewIntCol("at"),
	Text:         metaquery.NewTextCol("text"),
	Data:         metaquery.NewTextCol("data"),
	Ruled:        metaquery.NewTextCol("ruled"),
	Describes:    metaquery.NewIntCol("describes"),
	DescribedPct: metaquery.NewIntCol("described_pct"),
}

GetReadingForDocCols gives typed, name-safe access to GetReadingForDoc's output columns.

View Source
var InsertFragmentCols = struct {
	ID metaquery.IntCol
}{
	ID: metaquery.NewIntCol("id"),
}

InsertFragmentCols gives typed, name-safe access to InsertFragment's output columns.

View Source
var InsertMediaCols = struct {
	ID metaquery.IntCol
}{
	ID: metaquery.NewIntCol("id"),
}

InsertMediaCols gives typed, name-safe access to InsertMedia's output columns.

View Source
var JobStateCountsCols = struct {
	State metaquery.TextCol
	N     metaquery.IntCol
}{
	State: metaquery.NewTextCol("state"),
	N:     metaquery.NewIntCol("n"),
}

JobStateCountsCols gives typed, name-safe access to JobStateCounts's output columns.

View Source
var LaneQueueCountsCols = struct {
	Lane  metaquery.TextCol
	State metaquery.TextCol
	N     metaquery.IntCol
}{
	Lane:  metaquery.NewTextCol("lane"),
	State: metaquery.NewTextCol("state"),
	N:     metaquery.NewIntCol("n"),
}

LaneQueueCountsCols gives typed, name-safe access to LaneQueueCounts's output columns.

View Source
var ListActiveJobsCols = struct {
	ID    metaquery.IntCol
	Url   metaquery.TextCol
	State metaquery.TextCol
}{
	ID:    metaquery.NewIntCol("id"),
	Url:   metaquery.NewTextCol("url"),
	State: metaquery.NewTextCol("state"),
}

ListActiveJobsCols gives typed, name-safe access to ListActiveJobs's output columns.

View Source
var ListAllReadingsCols = struct {
	ID           metaquery.IntCol
	SourceSha256 metaquery.TextCol
	SourcePath   metaquery.TextCol
	DocPath      metaquery.TextCol
	Method       metaquery.TextCol
	Level        metaquery.TextCol
	ProducedBy   metaquery.TextCol
	RuledBy      metaquery.TextCol
	At           metaquery.IntCol
	Text         metaquery.TextCol
	Data         metaquery.TextCol
	Ruled        metaquery.TextCol
	Describes    metaquery.IntCol
	DescribedPct metaquery.IntCol
}{
	ID:           metaquery.NewIntCol("id"),
	SourceSha256: metaquery.NewTextCol("source_sha256"),
	SourcePath:   metaquery.NewTextCol("source_path"),
	DocPath:      metaquery.NewTextCol("doc_path"),
	Method:       metaquery.NewTextCol("method"),
	Level:        metaquery.NewTextCol("level"),
	ProducedBy:   metaquery.NewTextCol("produced_by"),
	RuledBy:      metaquery.NewTextCol("ruled_by"),
	At:           metaquery.NewIntCol("at"),
	Text:         metaquery.NewTextCol("text"),
	Data:         metaquery.NewTextCol("data"),
	Ruled:        metaquery.NewTextCol("ruled"),
	Describes:    metaquery.NewIntCol("describes"),
	DescribedPct: metaquery.NewIntCol("described_pct"),
}

ListAllReadingsCols gives typed, name-safe access to ListAllReadings's output columns.

View Source
var ListDocumentPathsCols = struct {
	Path metaquery.TextCol
}{
	Path: metaquery.NewTextCol("path"),
}

ListDocumentPathsCols gives typed, name-safe access to ListDocumentPaths's output columns.

View Source
var ListDocumentSummariesCols = struct {
	ID        metaquery.IntCol
	Path      metaquery.TextCol
	Title     metaquery.TextCol
	AddedAt   metaquery.IntCol
	FragMode  metaquery.TextCol
	Fragments metaquery.IntCol
}{
	ID:        metaquery.NewIntCol("id"),
	Path:      metaquery.NewTextCol("path"),
	Title:     metaquery.NewTextCol("title"),
	AddedAt:   metaquery.NewIntCol("added_at"),
	FragMode:  metaquery.NewTextCol("frag_mode"),
	Fragments: metaquery.NewIntCol("fragments"),
}

ListDocumentSummariesCols gives typed, name-safe access to ListDocumentSummaries's output columns.

View Source
var ListFragmentTextByPageCols = struct {
	Text metaquery.TextCol
}{
	Text: metaquery.NewTextCol("text"),
}

ListFragmentTextByPageCols gives typed, name-safe access to ListFragmentTextByPage's output columns.

View Source
var ListFragmentsForDocCols = struct {
	Page     metaquery.IntCol
	Ord      metaquery.IntCol
	Text     metaquery.TextCol
	StartOff metaquery.IntCol
	EndOff   metaquery.IntCol
}{
	Page:     metaquery.NewIntCol("page"),
	Ord:      metaquery.NewIntCol("ord"),
	Text:     metaquery.NewTextCol("text"),
	StartOff: metaquery.NewIntCol("start_off"),
	EndOff:   metaquery.NewIntCol("end_off"),
}

ListFragmentsForDocCols gives typed, name-safe access to ListFragmentsForDoc's output columns.

View Source
var ListJobStagesCols = struct {
	ID     metaquery.IntCol
	Seq    metaquery.IntCol
	Name   metaquery.TextCol
	Engine metaquery.TextCol
	State  metaquery.TextCol
	Detail metaquery.TextCol
	At     metaquery.IntCol
}{
	ID:     metaquery.NewIntCol("id"),
	Seq:    metaquery.NewIntCol("seq"),
	Name:   metaquery.NewTextCol("name"),
	Engine: metaquery.NewTextCol("engine"),
	State:  metaquery.NewTextCol("state"),
	Detail: metaquery.NewTextCol("detail"),
	At:     metaquery.NewIntCol("at"),
}

ListJobStagesCols gives typed, name-safe access to ListJobStages's output columns.

View Source
var ListJobsCols = struct {
	ID         metaquery.IntCol
	Url        metaquery.TextCol
	Title      metaquery.TextCol
	State      metaquery.TextCol
	Error      metaquery.TextCol
	Fragments  metaquery.IntCol
	Mode       metaquery.TextCol
	EnqueuedAt metaquery.IntCol
	StartedAt  metaquery.IntCol
	FinishedAt metaquery.IntCol
	OwnerPid   metaquery.IntCol
	Lane       metaquery.TextCol
}{
	ID:         metaquery.NewIntCol("id"),
	Url:        metaquery.NewTextCol("url"),
	Title:      metaquery.NewTextCol("title"),
	State:      metaquery.NewTextCol("state"),
	Error:      metaquery.NewTextCol("error"),
	Fragments:  metaquery.NewIntCol("fragments"),
	Mode:       metaquery.NewTextCol("mode"),
	EnqueuedAt: metaquery.NewIntCol("enqueued_at"),
	StartedAt:  metaquery.NewIntCol("started_at"),
	FinishedAt: metaquery.NewIntCol("finished_at"),
	OwnerPid:   metaquery.NewIntCol("owner_pid"),
	Lane:       metaquery.NewTextCol("lane"),
}

ListJobsCols gives typed, name-safe access to ListJobs's output columns.

View Source
var ListMediaByDocCols = struct {
	Page        metaquery.IntCol
	Ord         metaquery.IntCol
	Kind        metaquery.TextCol
	ImagePath   metaquery.TextCol
	Bbox        metaquery.TextCol
	Description metaquery.TextCol
	FragmentID  metaquery.AnyCol
}{
	Page:        metaquery.NewIntCol("page"),
	Ord:         metaquery.NewIntCol("ord"),
	Kind:        metaquery.NewTextCol("kind"),
	ImagePath:   metaquery.NewTextCol("image_path"),
	Bbox:        metaquery.NewTextCol("bbox"),
	Description: metaquery.NewTextCol("description"),
	FragmentID:  metaquery.NewAnyCol("fragment_id"),
}

ListMediaByDocCols gives typed, name-safe access to ListMediaByDoc's output columns.

View Source
var ListMediaByFragmentCols = struct {
	Page        metaquery.IntCol
	Ord         metaquery.IntCol
	Kind        metaquery.TextCol
	ImagePath   metaquery.TextCol
	Bbox        metaquery.TextCol
	Description metaquery.TextCol
}{
	Page:        metaquery.NewIntCol("page"),
	Ord:         metaquery.NewIntCol("ord"),
	Kind:        metaquery.NewTextCol("kind"),
	ImagePath:   metaquery.NewTextCol("image_path"),
	Bbox:        metaquery.NewTextCol("bbox"),
	Description: metaquery.NewTextCol("description"),
}

ListMediaByFragmentCols gives typed, name-safe access to ListMediaByFragment's output columns.

View Source
var ListOcrPagesByDocCols = struct {
	Page           metaquery.IntCol
	Engine         metaquery.TextCol
	ImagePath      metaquery.TextCol
	TextChars      metaquery.IntCol
	DescribedChars metaquery.IntCol
}{
	Page:           metaquery.NewIntCol("page"),
	Engine:         metaquery.NewTextCol("engine"),
	ImagePath:      metaquery.NewTextCol("image_path"),
	TextChars:      metaquery.NewIntCol("text_chars"),
	DescribedChars: metaquery.NewIntCol("described_chars"),
}

ListOcrPagesByDocCols gives typed, name-safe access to ListOcrPagesByDoc's output columns.

View Source
var ListReadingsOfSourceCols = struct {
	ID           metaquery.IntCol
	SourceSha256 metaquery.TextCol
	SourcePath   metaquery.TextCol
	DocPath      metaquery.TextCol
	Method       metaquery.TextCol
	Level        metaquery.TextCol
	ProducedBy   metaquery.TextCol
	RuledBy      metaquery.TextCol
	At           metaquery.IntCol
	Text         metaquery.TextCol
	Data         metaquery.TextCol
	Ruled        metaquery.TextCol
	Describes    metaquery.IntCol
	DescribedPct metaquery.IntCol
}{
	ID:           metaquery.NewIntCol("id"),
	SourceSha256: metaquery.NewTextCol("source_sha256"),
	SourcePath:   metaquery.NewTextCol("source_path"),
	DocPath:      metaquery.NewTextCol("doc_path"),
	Method:       metaquery.NewTextCol("method"),
	Level:        metaquery.NewTextCol("level"),
	ProducedBy:   metaquery.NewTextCol("produced_by"),
	RuledBy:      metaquery.NewTextCol("ruled_by"),
	At:           metaquery.NewIntCol("at"),
	Text:         metaquery.NewTextCol("text"),
	Data:         metaquery.NewTextCol("data"),
	Ruled:        metaquery.NewTextCol("ruled"),
	Describes:    metaquery.NewIntCol("describes"),
	DescribedPct: metaquery.NewIntCol("described_pct"),
}

ListReadingsOfSourceCols gives typed, name-safe access to ListReadingsOfSource's output columns.

View Source
var ListRunningJobOwnersCols = struct {
	ID        metaquery.IntCol
	Url       metaquery.TextCol
	OwnerPid  metaquery.IntCol
	StartedAt metaquery.IntCol
}{
	ID:        metaquery.NewIntCol("id"),
	Url:       metaquery.NewTextCol("url"),
	OwnerPid:  metaquery.NewIntCol("owner_pid"),
	StartedAt: metaquery.NewIntCol("started_at"),
}

ListRunningJobOwnersCols gives typed, name-safe access to ListRunningJobOwners's output columns.

View Source
var ListTombstonesCols = struct {
	Path metaquery.TextCol
}{
	Path: metaquery.NewTextCol("path"),
}

ListTombstonesCols gives typed, name-safe access to ListTombstones's output columns.

View Source
var ListUnlanedPendingJobsCols = struct {
	ID  metaquery.IntCol
	Url metaquery.TextCol
}{
	ID:  metaquery.NewIntCol("id"),
	Url: metaquery.NewTextCol("url"),
}

ListUnlanedPendingJobsCols gives typed, name-safe access to ListUnlanedPendingJobs's output columns.

View Source
var MatchDocumentsLikeCols = struct {
	Path  metaquery.TextCol
	Title metaquery.TextCol
}{
	Path:  metaquery.NewTextCol("path"),
	Title: metaquery.NewTextCol("title"),
}

MatchDocumentsLikeCols gives typed, name-safe access to MatchDocumentsLike's output columns.

View Source
var MetaAbortJob = metaquery.Query{
	Name:    "AbortJob",
	Cmd:     ":execrows",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `UPDATE ingest_jobs SET state='error', error=?, finished_at=?
WHERE id=? AND state='running'`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "error", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "finished_at", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaCancelJob = metaquery.Query{
	Name:    "CancelJob",
	Cmd:     ":execrows",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `DELETE FROM ingest_jobs WHERE id=? AND state='pending'`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaCompleteJob = metaquery.Query{
	Name:    "CompleteJob",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `UPDATE ingest_jobs SET state='done', fragments=?, mode=?, error='', finished_at=? WHERE id=?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "fragments", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "mode", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 3, Name: "finished_at", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 4, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaCountDocuments = metaquery.Query{
	Name:    "CountDocuments",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT COUNT(*) AS n FROM documents`,
	Columns: []metaquery.Column{
		{Name: "n", OriginalName: "n", GoType: "int64"},
	},
}
View Source
var MetaCountFragments = metaquery.Query{
	Name:    "CountFragments",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT COUNT(*) AS n FROM fragments`,
	Columns: []metaquery.Column{
		{Name: "n", OriginalName: "n", GoType: "int64"},
	},
}
View Source
var MetaDeleteDocumentByPath = metaquery.Query{
	Name:    "DeleteDocumentByPath",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `DELETE FROM documents WHERE path = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaDeleteFragmentsByDoc = metaquery.Query{
	Name:    "DeleteFragmentsByDoc",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `DELETE FROM fragments WHERE doc_id = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaDeleteMediaByDoc = metaquery.Query{
	Name:    "DeleteMediaByDoc",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `DELETE FROM media WHERE doc_id = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaDeleteOcrPagesByDoc = metaquery.Query{
	Name:    "DeleteOcrPagesByDoc",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `DELETE FROM ocr_pages WHERE doc_id = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaDeleteTombstone = metaquery.Query{
	Name:    "DeleteTombstone",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `DELETE FROM tombstones WHERE path = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaEnqueueJob = metaquery.Query{
	Name:    "EnqueueJob",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `INSERT INTO ingest_jobs(url, title, state, enqueued_at) VALUES(?, ?, 'pending', ?) RETURNING id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "url", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "title", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 3, Name: "enqueued_at", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
	Table: &metaquery.Table{Name: "ingest_jobs"},
}
View Source
var MetaExportFragments = metaquery.Query{
	Name:    "ExportFragments",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT f.page, f.ord, f.text, f.start_off, f.end_off, f.page_spans, fv.vec
FROM fragments f LEFT JOIN fragment_vectors fv ON fv.fragment_id = f.id
WHERE f.doc_id = ? ORDER BY f.page, f.ord`,
	Columns: []metaquery.Column{
		{Name: "page", OriginalName: "page", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
		{Name: "ord", OriginalName: "ord", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
		{Name: "text", OriginalName: "text", GoType: "string", DBType: "TEXT", NotNull: true, Table: "fragments"},
		{Name: "start_off", OriginalName: "start_off", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
		{Name: "end_off", OriginalName: "end_off", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
		{Name: "page_spans", OriginalName: "page_spans", GoType: "string", DBType: "TEXT", NotNull: true, Table: "fragments"},
		{Name: "vec", OriginalName: "vec", GoType: "[]byte", DBType: "BLOB", Table: "fragment_vectors"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaFailJob = metaquery.Query{
	Name:    "FailJob",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `UPDATE ingest_jobs SET state='error', error=?, finished_at=? WHERE id=?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "error", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "finished_at", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaFindPathByHash = metaquery.Query{
	Name:    "FindPathByHash",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT path FROM documents
WHERE content_hash = ? AND content_hash != '' AND path != ?
ORDER BY id LIMIT 1`,
	Columns: []metaquery.Column{
		{Name: "path", OriginalName: "path", GoType: "string"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "content_hash", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaGetDocumentByPath = metaquery.Query{
	Name:    "GetDocumentByPath",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `
SELECT id, path, title, added_at FROM documents WHERE path = ?`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "documents"},
		{Name: "path", OriginalName: "path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
		{Name: "title", OriginalName: "title", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
		{Name: "added_at", OriginalName: "added_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "documents"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaGetDocumentFrag = metaquery.Query{
	Name:    "GetDocumentFrag",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT frag_mode, frag_recipe FROM documents WHERE id = ?`,
	Columns: []metaquery.Column{
		{Name: "frag_mode", OriginalName: "frag_mode", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
		{Name: "frag_recipe", OriginalName: "frag_recipe", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaGetDocumentHash = metaquery.Query{
	Name:    "GetDocumentHash",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT content_hash FROM documents WHERE path = ?`,
	Columns: []metaquery.Column{
		{Name: "content_hash", OriginalName: "content_hash", GoType: "string"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaGetJob = metaquery.Query{
	Name:    "GetJob",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT id, url, title, state, error, fragments, mode, enqueued_at, started_at, finished_at, owner_pid, lane
FROM ingest_jobs WHERE id = ?`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "url", OriginalName: "url", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "title", OriginalName: "title", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "state", OriginalName: "state", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "error", OriginalName: "error", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "fragments", OriginalName: "fragments", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "mode", OriginalName: "mode", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "enqueued_at", OriginalName: "enqueued_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "started_at", OriginalName: "started_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "finished_at", OriginalName: "finished_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "owner_pid", OriginalName: "owner_pid", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "lane", OriginalName: "lane", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaGetOldestPendingJob = metaquery.Query{
	Name:    "GetOldestPendingJob",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT id, url, title, enqueued_at FROM ingest_jobs WHERE state='pending' ORDER BY id LIMIT 1`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "url", OriginalName: "url", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "title", OriginalName: "title", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "enqueued_at", OriginalName: "enqueued_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
	},
}
View Source
var MetaGetOldestPendingJobInLane = metaquery.Query{
	Name:    "GetOldestPendingJobInLane",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT id, url, title, enqueued_at FROM ingest_jobs
WHERE state='pending' AND lane = ? ORDER BY id LIMIT 1`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "url", OriginalName: "url", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "title", OriginalName: "title", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "enqueued_at", OriginalName: "enqueued_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "lane", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaGetPageImagePath = metaquery.Query{
	Name:    "GetPageImagePath",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT p.image_path FROM ocr_pages p JOIN documents d ON d.id = p.doc_id
WHERE d.path = ? AND p.page = ?`,
	Columns: []metaquery.Column{
		{Name: "image_path", OriginalName: "image_path", GoType: "string"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "page", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaGetReadingForDoc = metaquery.Query{
	Name:    "GetReadingForDoc",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT id, source_sha256, source_path, doc_path, method, level, produced_by, ruled_by, at, text, data, ruled, describes, described_pct
FROM readings WHERE doc_path = ?`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "source_sha256", OriginalName: "source_sha256", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "source_path", OriginalName: "source_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "doc_path", OriginalName: "doc_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "method", OriginalName: "method", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "level", OriginalName: "level", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "produced_by", OriginalName: "produced_by", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "ruled_by", OriginalName: "ruled_by", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "at", OriginalName: "at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "text", OriginalName: "text", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "data", OriginalName: "data", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "ruled", OriginalName: "ruled", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "describes", OriginalName: "describes", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "described_pct", OriginalName: "described_pct", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaInsertFragment = metaquery.Query{
	Name:    "InsertFragment",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `INSERT INTO fragments(doc_id, page, ord, text, start_off, end_off, start_line, end_line, symbol, page_spans, origin)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "page", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "ord", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 4, Name: "text", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 5, Name: "start_off", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 6, Name: "end_off", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 7, Name: "start_line", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 8, Name: "end_line", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 9, Name: "symbol", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 10, Name: "page_spans", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 11, Name: "origin", GoType: "string", DBType: "TEXT", NotNull: true},
	},
	Table: &metaquery.Table{Name: "fragments"},
}
View Source
var MetaInsertMedia = metaquery.Query{
	Name:    "InsertMedia",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `INSERT INTO media(doc_id, page, ord, kind, image_path, bbox, description, fragment_id)
VALUES(?,?,?,?,?,?,?,?) RETURNING id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "page", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "ord", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 4, Name: "kind", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 5, Name: "image_path", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 6, Name: "bbox", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 7, Name: "description", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 8, Name: "fragment_id", GoType: "sql.NullInt64", DBType: "INTEGER"},
	},
	Table: &metaquery.Table{Name: "media"},
}
View Source
var MetaInsertMediaVector = metaquery.Query{
	Name:    "InsertMediaVector",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `INSERT INTO media_vectors(media_id, dim, vec, space) VALUES(?,?,?,?)`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "media_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "dim", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "vec", GoType: "[]byte", DBType: "BLOB", NotNull: true},
		{Position: 4, Name: "space", GoType: "string", DBType: "TEXT", NotNull: true},
	},
	Table: &metaquery.Table{Name: "media_vectors"},
}
View Source
var MetaInsertStage = metaquery.Query{
	Name:    "InsertStage",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `INSERT INTO job_stages(job_id, seq, name, engine, state, detail, at) VALUES(?,?,?,?,?,?,?)`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "job_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "seq", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "name", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 4, Name: "engine", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 5, Name: "state", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 6, Name: "detail", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 7, Name: "at", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
	Table: &metaquery.Table{Name: "job_stages"},
}
View Source
var MetaInsertTombstone = metaquery.Query{
	Name:    "InsertTombstone",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `INSERT OR IGNORE INTO tombstones(path) VALUES(?)`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
	Table: &metaquery.Table{Name: "tombstones"},
}
View Source
var MetaInsertVector = metaquery.Query{
	Name:    "InsertVector",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `INSERT INTO fragment_vectors(fragment_id, dim, vec) VALUES(?, ?, ?)`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "fragment_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "dim", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "vec", GoType: "[]byte", DBType: "BLOB", NotNull: true},
	},
	Table: &metaquery.Table{Name: "fragment_vectors"},
}
View Source
var MetaJobStateCounts = metaquery.Query{
	Name:    "JobStateCounts",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT state, COUNT(*) AS n FROM ingest_jobs GROUP BY state`,
	Columns: []metaquery.Column{
		{Name: "state", OriginalName: "state", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "n", OriginalName: "n", GoType: "int64", DBType: "integer", NotNull: true},
	},
}
View Source
var MetaLaneQueueCounts = metaquery.Query{
	Name:    "LaneQueueCounts",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT lane, state, COUNT(*) AS n FROM ingest_jobs
WHERE state IN ('pending','running') GROUP BY lane, state`,
	Columns: []metaquery.Column{
		{Name: "lane", OriginalName: "lane", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "state", OriginalName: "state", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "n", OriginalName: "n", GoType: "int64", DBType: "integer", NotNull: true},
	},
}
View Source
var MetaListActiveJobs = metaquery.Query{
	Name:    "ListActiveJobs",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT id, url, state FROM ingest_jobs
WHERE state IN ('running','pending')
ORDER BY CASE state WHEN 'running' THEN 0 ELSE 1 END, id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "url", OriginalName: "url", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "state", OriginalName: "state", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
	},
}
View Source
var MetaListAllReadings = metaquery.Query{
	Name:    "ListAllReadings",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT id, source_sha256, source_path, doc_path, method, level, produced_by, ruled_by, at, text, data, ruled, describes, described_pct
FROM readings ORDER BY source_sha256, at, id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "source_sha256", OriginalName: "source_sha256", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "source_path", OriginalName: "source_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "doc_path", OriginalName: "doc_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "method", OriginalName: "method", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "level", OriginalName: "level", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "produced_by", OriginalName: "produced_by", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "ruled_by", OriginalName: "ruled_by", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "at", OriginalName: "at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "text", OriginalName: "text", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "data", OriginalName: "data", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "ruled", OriginalName: "ruled", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "describes", OriginalName: "describes", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "described_pct", OriginalName: "described_pct", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
	},
}
View Source
var MetaListDocumentPaths = metaquery.Query{
	Name:    "ListDocumentPaths",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT path FROM documents`,
	Columns: []metaquery.Column{
		{Name: "path", OriginalName: "path", GoType: "string"},
	},
}
View Source
var MetaListDocumentSummaries = metaquery.Query{
	Name:    "ListDocumentSummaries",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT d.id, d.path, d.title, d.added_at, d.frag_mode,
       (SELECT COUNT(*) FROM fragments f WHERE f.doc_id = d.id) AS fragments
FROM documents d ORDER BY d.added_at DESC`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "documents"},
		{Name: "path", OriginalName: "path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
		{Name: "title", OriginalName: "title", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
		{Name: "added_at", OriginalName: "added_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "documents"},
		{Name: "frag_mode", OriginalName: "frag_mode", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
		{Name: "fragments", OriginalName: "fragments", GoType: "int64", DBType: "integer", NotNull: true},
	},
}
View Source
var MetaListFragmentTextByPage = metaquery.Query{
	Name:    "ListFragmentTextByPage",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT text FROM fragments WHERE doc_id = ? AND page = ? ORDER BY ord`,
	Columns: []metaquery.Column{
		{Name: "text", OriginalName: "text", GoType: "string"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "page", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaListFragmentsForDoc = metaquery.Query{
	Name:    "ListFragmentsForDoc",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT page, ord, text, start_off, end_off FROM fragments WHERE doc_id = ? ORDER BY page, ord`,
	Columns: []metaquery.Column{
		{Name: "page", OriginalName: "page", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
		{Name: "ord", OriginalName: "ord", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
		{Name: "text", OriginalName: "text", GoType: "string", DBType: "TEXT", NotNull: true, Table: "fragments"},
		{Name: "start_off", OriginalName: "start_off", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
		{Name: "end_off", OriginalName: "end_off", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "fragments"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaListJobStages = metaquery.Query{
	Name:    "ListJobStages",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT id, seq, name, engine, state, detail, at FROM job_stages WHERE job_id = ? ORDER BY id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "job_stages"},
		{Name: "seq", OriginalName: "seq", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "job_stages"},
		{Name: "name", OriginalName: "name", GoType: "string", DBType: "TEXT", NotNull: true, Table: "job_stages"},
		{Name: "engine", OriginalName: "engine", GoType: "string", DBType: "TEXT", NotNull: true, Table: "job_stages"},
		{Name: "state", OriginalName: "state", GoType: "string", DBType: "TEXT", NotNull: true, Table: "job_stages"},
		{Name: "detail", OriginalName: "detail", GoType: "string", DBType: "TEXT", NotNull: true, Table: "job_stages"},
		{Name: "at", OriginalName: "at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "job_stages"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "job_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaListJobs = metaquery.Query{
	Name:    "ListJobs",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT id, url, title, state, error, fragments, mode, enqueued_at, started_at, finished_at, owner_pid, lane
FROM ingest_jobs`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "url", OriginalName: "url", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "title", OriginalName: "title", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "state", OriginalName: "state", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "error", OriginalName: "error", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "fragments", OriginalName: "fragments", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "mode", OriginalName: "mode", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "enqueued_at", OriginalName: "enqueued_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "started_at", OriginalName: "started_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "finished_at", OriginalName: "finished_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "owner_pid", OriginalName: "owner_pid", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "lane", OriginalName: "lane", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
	},
}
View Source
var MetaListMediaByDoc = metaquery.Query{
	Name:    "ListMediaByDoc",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT page, ord, kind, image_path, bbox, description, fragment_id
FROM media WHERE doc_id = ? ORDER BY page, ord`,
	Columns: []metaquery.Column{
		{Name: "page", OriginalName: "page", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "media"},
		{Name: "ord", OriginalName: "ord", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "media"},
		{Name: "kind", OriginalName: "kind", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
		{Name: "image_path", OriginalName: "image_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
		{Name: "bbox", OriginalName: "bbox", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
		{Name: "description", OriginalName: "description", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
		{Name: "fragment_id", OriginalName: "fragment_id", GoType: "sql.NullInt64", DBType: "INTEGER", Table: "media"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaListMediaByFragment = metaquery.Query{
	Name:    "ListMediaByFragment",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT page, ord, kind, image_path, bbox, description
FROM media WHERE fragment_id = ? ORDER BY ord`,
	Columns: []metaquery.Column{
		{Name: "page", OriginalName: "page", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "media"},
		{Name: "ord", OriginalName: "ord", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "media"},
		{Name: "kind", OriginalName: "kind", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
		{Name: "image_path", OriginalName: "image_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
		{Name: "bbox", OriginalName: "bbox", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
		{Name: "description", OriginalName: "description", GoType: "string", DBType: "TEXT", NotNull: true, Table: "media"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "fragment_id", GoType: "sql.NullInt64", DBType: "INTEGER"},
	},
}
View Source
var MetaListOcrPagesByDoc = metaquery.Query{
	Name:    "ListOcrPagesByDoc",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT page, engine, image_path, text_chars, described_chars FROM ocr_pages WHERE doc_id = ? ORDER BY page`,
	Columns: []metaquery.Column{
		{Name: "page", OriginalName: "page", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ocr_pages"},
		{Name: "engine", OriginalName: "engine", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ocr_pages"},
		{Name: "image_path", OriginalName: "image_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ocr_pages"},
		{Name: "text_chars", OriginalName: "text_chars", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ocr_pages"},
		{Name: "described_chars", OriginalName: "described_chars", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ocr_pages"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaListReadingsOfSource = metaquery.Query{
	Name:    "ListReadingsOfSource",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT id, source_sha256, source_path, doc_path, method, level, produced_by, ruled_by, at, text, data, ruled, describes, described_pct
FROM readings WHERE source_sha256 = ? AND source_sha256 <> '' ORDER BY at, id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "source_sha256", OriginalName: "source_sha256", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "source_path", OriginalName: "source_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "doc_path", OriginalName: "doc_path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "method", OriginalName: "method", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "level", OriginalName: "level", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "produced_by", OriginalName: "produced_by", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "ruled_by", OriginalName: "ruled_by", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "at", OriginalName: "at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "text", OriginalName: "text", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "data", OriginalName: "data", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "ruled", OriginalName: "ruled", GoType: "string", DBType: "TEXT", NotNull: true, Table: "readings"},
		{Name: "describes", OriginalName: "describes", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
		{Name: "described_pct", OriginalName: "described_pct", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "readings"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "source_sha256", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaListRunningJobOwners = metaquery.Query{
	Name:    "ListRunningJobOwners",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT id, url, owner_pid, started_at FROM ingest_jobs WHERE state='running'`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "url", OriginalName: "url", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
		{Name: "owner_pid", OriginalName: "owner_pid", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "started_at", OriginalName: "started_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
	},
}
View Source
var MetaListTombstones = metaquery.Query{
	Name:    "ListTombstones",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT path FROM tombstones`,
	Columns: []metaquery.Column{
		{Name: "path", OriginalName: "path", GoType: "string"},
	},
}
View Source
var MetaListUnlanedPendingJobs = metaquery.Query{
	Name:    "ListUnlanedPendingJobs",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT id, url FROM ingest_jobs WHERE state='pending' AND lane = ''`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "url", OriginalName: "url", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ingest_jobs"},
	},
}
View Source
var MetaMatchDocumentsLike = metaquery.Query{
	Name:    "MatchDocumentsLike",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT path, title FROM documents
WHERE lower(path) LIKE ? OR lower(title) LIKE ?
ORDER BY added_at DESC`,
	Columns: []metaquery.Column{
		{Name: "path", OriginalName: "path", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
		{Name: "title", OriginalName: "title", GoType: "string", DBType: "TEXT", NotNull: true, Table: "documents"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "title", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaOcrEngineCountsByDoc = metaquery.Query{
	Name:    "OcrEngineCountsByDoc",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `SELECT engine, COUNT(*) AS n FROM ocr_pages WHERE doc_id = ? GROUP BY engine`,
	Columns: []metaquery.Column{
		{Name: "engine", OriginalName: "engine", GoType: "string", DBType: "TEXT", NotNull: true, Table: "ocr_pages"},
		{Name: "n", OriginalName: "n", GoType: "int64", DBType: "integer", NotNull: true},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaRecentDoneDurations = metaquery.Query{
	Name:    "RecentDoneDurations",
	Cmd:     ":many",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `SELECT started_at, finished_at FROM ingest_jobs
WHERE state='done' AND started_at>0 AND finished_at>=started_at
ORDER BY finished_at DESC LIMIT 10`,
	Columns: []metaquery.Column{
		{Name: "started_at", OriginalName: "started_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
		{Name: "finished_at", OriginalName: "finished_at", GoType: "int64", DBType: "INTEGER", NotNull: true, Table: "ingest_jobs"},
	},
}
View Source
var MetaRetryJob = metaquery.Query{
	Name:    "RetryJob",
	Cmd:     ":execrows",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `UPDATE ingest_jobs SET state='pending', error='', started_at=0, finished_at=0, fragments=0
WHERE id=? AND state IN ('error','done')`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaSetDocumentFrag = metaquery.Query{
	Name:    "SetDocumentFrag",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `UPDATE documents SET frag_mode = ?, frag_recipe = ? WHERE id = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "frag_mode", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "frag_recipe", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 3, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaSetDocumentHash = metaquery.Query{
	Name:    "SetDocumentHash",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `UPDATE documents SET content_hash = ? WHERE path = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "content_hash", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
	},
}
View Source
var MetaSetJobLane = metaquery.Query{
	Name:    "SetJobLane",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `UPDATE ingest_jobs SET lane = ? WHERE id = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "lane", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaSetJobRunning = metaquery.Query{
	Name:    "SetJobRunning",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `UPDATE ingest_jobs SET state='running', started_at=?, owner_pid=? WHERE id=?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "started_at", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "owner_pid", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaSetJobURL = metaquery.Query{
	Name:    "SetJobURL",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL:     `UPDATE ingest_jobs SET url = ? WHERE id = ?`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "url", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "id", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
}
View Source
var MetaUpsertDocument = metaquery.Query{
	Name:    "UpsertDocument",
	Cmd:     ":one",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `INSERT INTO documents(path, title, added_at) VALUES(?, ?, ?)
ON CONFLICT(path) DO UPDATE SET title=excluded.title, added_at=excluded.added_at
RETURNING id`,
	Columns: []metaquery.Column{
		{Name: "id", OriginalName: "id", GoType: "int64"},
	},
	Args: []metaquery.Arg{
		{Position: 1, Name: "path", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "title", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 3, Name: "added_at", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
	Table: &metaquery.Table{Name: "documents"},
}
View Source
var MetaUpsertOcrPage = metaquery.Query{
	Name:    "UpsertOcrPage",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `INSERT INTO ocr_pages(doc_id, page, engine, image_path, text_chars, described_chars) VALUES(?,?,?,?,?,?)
ON CONFLICT(doc_id, page) DO UPDATE SET engine=excluded.engine, image_path=excluded.image_path,
  text_chars=excluded.text_chars, described_chars=excluded.described_chars`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "doc_id", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 2, Name: "page", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 3, Name: "engine", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 4, Name: "image_path", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 5, Name: "text_chars", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 6, Name: "described_chars", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
	Table: &metaquery.Table{Name: "ocr_pages"},
}
View Source
var MetaUpsertReading = metaquery.Query{
	Name:    "UpsertReading",
	Cmd:     ":exec",
	Source:  "query.sql",
	Dialect: metaquery.DialectSQLite,
	SQL: `INSERT INTO readings(source_sha256, source_path, doc_path, method, level, produced_by, ruled_by, at, text, data, ruled, describes, described_pct)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)
ON CONFLICT(doc_path) DO UPDATE SET
  source_sha256=excluded.source_sha256, source_path=excluded.source_path,
  method=excluded.method, level=excluded.level, produced_by=excluded.produced_by,
  ruled_by=excluded.ruled_by, at=excluded.at, text=excluded.text, data=excluded.data,
  ruled=excluded.ruled, describes=excluded.describes, described_pct=excluded.described_pct`,
	Args: []metaquery.Arg{
		{Position: 1, Name: "source_sha256", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 2, Name: "source_path", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 3, Name: "doc_path", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 4, Name: "method", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 5, Name: "level", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 6, Name: "produced_by", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 7, Name: "ruled_by", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 8, Name: "at", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 9, Name: "text", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 10, Name: "data", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 11, Name: "ruled", GoType: "string", DBType: "TEXT", NotNull: true},
		{Position: 12, Name: "describes", GoType: "int64", DBType: "INTEGER", NotNull: true},
		{Position: 13, Name: "described_pct", GoType: "int64", DBType: "INTEGER", NotNull: true},
	},
	Table: &metaquery.Table{Name: "readings"},
}
View Source
var OcrEngineCountsByDocCols = struct {
	Engine metaquery.TextCol
	N      metaquery.IntCol
}{
	Engine: metaquery.NewTextCol("engine"),
	N:      metaquery.NewIntCol("n"),
}

OcrEngineCountsByDocCols gives typed, name-safe access to OcrEngineCountsByDoc's output columns.

View Source
var RecentDoneDurationsCols = struct {
	StartedAt  metaquery.IntCol
	FinishedAt metaquery.IntCol
}{
	StartedAt:  metaquery.NewIntCol("started_at"),
	FinishedAt: metaquery.NewIntCol("finished_at"),
}

RecentDoneDurationsCols gives typed, name-safe access to RecentDoneDurations's output columns.

View Source
var UpsertDocumentCols = struct {
	ID metaquery.IntCol
}{
	ID: metaquery.NewIntCol("id"),
}

UpsertDocumentCols gives typed, name-safe access to UpsertDocument's output columns.

Functions

func WrapAbortJob

func WrapAbortJob(arg AbortJobParams) *metaquery.Builder

WrapAbortJob returns a metaquery.Builder over MetaAbortJob, pre-bound with typed arguments.

func WrapCancelJob

func WrapCancelJob(id int64) *metaquery.Builder

WrapCancelJob returns a metaquery.Builder over MetaCancelJob, pre-bound with typed arguments.

func WrapCompleteJob

func WrapCompleteJob(arg CompleteJobParams) *metaquery.Builder

WrapCompleteJob returns a metaquery.Builder over MetaCompleteJob, pre-bound with typed arguments.

func WrapCountDocuments

func WrapCountDocuments() *metaquery.Builder

WrapCountDocuments returns a metaquery.Builder over MetaCountDocuments, pre-bound with typed arguments.

func WrapCountFragments

func WrapCountFragments() *metaquery.Builder

WrapCountFragments returns a metaquery.Builder over MetaCountFragments, pre-bound with typed arguments.

func WrapDeleteDocumentByPath

func WrapDeleteDocumentByPath(path string) *metaquery.Builder

WrapDeleteDocumentByPath returns a metaquery.Builder over MetaDeleteDocumentByPath, pre-bound with typed arguments.

func WrapDeleteFragmentsByDoc

func WrapDeleteFragmentsByDoc(docID int64) *metaquery.Builder

WrapDeleteFragmentsByDoc returns a metaquery.Builder over MetaDeleteFragmentsByDoc, pre-bound with typed arguments.

func WrapDeleteMediaByDoc

func WrapDeleteMediaByDoc(docID int64) *metaquery.Builder

WrapDeleteMediaByDoc returns a metaquery.Builder over MetaDeleteMediaByDoc, pre-bound with typed arguments.

func WrapDeleteOcrPagesByDoc

func WrapDeleteOcrPagesByDoc(docID int64) *metaquery.Builder

WrapDeleteOcrPagesByDoc returns a metaquery.Builder over MetaDeleteOcrPagesByDoc, pre-bound with typed arguments.

func WrapDeleteTombstone

func WrapDeleteTombstone(path string) *metaquery.Builder

WrapDeleteTombstone returns a metaquery.Builder over MetaDeleteTombstone, pre-bound with typed arguments.

func WrapEnqueueJob

func WrapEnqueueJob(arg EnqueueJobParams) *metaquery.Builder

WrapEnqueueJob returns a metaquery.Builder over MetaEnqueueJob, pre-bound with typed arguments.

func WrapExportFragments

func WrapExportFragments(docID int64) *metaquery.Builder

WARNING: ExportFragments ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapExportFragments returns a metaquery.Builder over MetaExportFragments, pre-bound with typed arguments.

func WrapFailJob

func WrapFailJob(arg FailJobParams) *metaquery.Builder

WrapFailJob returns a metaquery.Builder over MetaFailJob, pre-bound with typed arguments.

func WrapFindPathByHash added in v0.6.0

func WrapFindPathByHash(arg FindPathByHashParams) *metaquery.Builder

WARNING: FindPathByHash ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapFindPathByHash returns a metaquery.Builder over MetaFindPathByHash, pre-bound with typed arguments.

func WrapGetDocumentByPath

func WrapGetDocumentByPath(path string) *metaquery.Builder

WrapGetDocumentByPath returns a metaquery.Builder over MetaGetDocumentByPath, pre-bound with typed arguments.

func WrapGetDocumentFrag

func WrapGetDocumentFrag(id int64) *metaquery.Builder

WrapGetDocumentFrag returns a metaquery.Builder over MetaGetDocumentFrag, pre-bound with typed arguments.

func WrapGetDocumentHash

func WrapGetDocumentHash(path string) *metaquery.Builder

WrapGetDocumentHash returns a metaquery.Builder over MetaGetDocumentHash, pre-bound with typed arguments.

func WrapGetJob

func WrapGetJob(id int64) *metaquery.Builder

WrapGetJob returns a metaquery.Builder over MetaGetJob, pre-bound with typed arguments.

func WrapGetOldestPendingJob

func WrapGetOldestPendingJob() *metaquery.Builder

WARNING: GetOldestPendingJob ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapGetOldestPendingJob returns a metaquery.Builder over MetaGetOldestPendingJob, pre-bound with typed arguments.

func WrapGetOldestPendingJobInLane

func WrapGetOldestPendingJobInLane(lane string) *metaquery.Builder

WARNING: GetOldestPendingJobInLane ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapGetOldestPendingJobInLane returns a metaquery.Builder over MetaGetOldestPendingJobInLane, pre-bound with typed arguments.

func WrapGetPageImagePath

func WrapGetPageImagePath(arg GetPageImagePathParams) *metaquery.Builder

WrapGetPageImagePath returns a metaquery.Builder over MetaGetPageImagePath, pre-bound with typed arguments.

func WrapGetReadingForDoc

func WrapGetReadingForDoc(docPath string) *metaquery.Builder

WrapGetReadingForDoc returns a metaquery.Builder over MetaGetReadingForDoc, pre-bound with typed arguments.

func WrapInsertFragment

func WrapInsertFragment(arg InsertFragmentParams) *metaquery.Builder

WrapInsertFragment returns a metaquery.Builder over MetaInsertFragment, pre-bound with typed arguments.

func WrapInsertMedia

func WrapInsertMedia(arg InsertMediaParams) *metaquery.Builder

WrapInsertMedia returns a metaquery.Builder over MetaInsertMedia, pre-bound with typed arguments.

func WrapInsertMediaVector

func WrapInsertMediaVector(arg InsertMediaVectorParams) *metaquery.Builder

WrapInsertMediaVector returns a metaquery.Builder over MetaInsertMediaVector, pre-bound with typed arguments.

func WrapInsertStage

func WrapInsertStage(arg InsertStageParams) *metaquery.Builder

WrapInsertStage returns a metaquery.Builder over MetaInsertStage, pre-bound with typed arguments.

func WrapInsertTombstone

func WrapInsertTombstone(path string) *metaquery.Builder

WrapInsertTombstone returns a metaquery.Builder over MetaInsertTombstone, pre-bound with typed arguments.

func WrapInsertVector

func WrapInsertVector(arg InsertVectorParams) *metaquery.Builder

WrapInsertVector returns a metaquery.Builder over MetaInsertVector, pre-bound with typed arguments.

func WrapJobStateCounts

func WrapJobStateCounts() *metaquery.Builder

WrapJobStateCounts returns a metaquery.Builder over MetaJobStateCounts, pre-bound with typed arguments.

func WrapLaneQueueCounts

func WrapLaneQueueCounts() *metaquery.Builder

WrapLaneQueueCounts returns a metaquery.Builder over MetaLaneQueueCounts, pre-bound with typed arguments.

func WrapListActiveJobs

func WrapListActiveJobs() *metaquery.Builder

WARNING: ListActiveJobs ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListActiveJobs returns a metaquery.Builder over MetaListActiveJobs, pre-bound with typed arguments.

func WrapListAllReadings

func WrapListAllReadings() *metaquery.Builder

WARNING: ListAllReadings ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListAllReadings returns a metaquery.Builder over MetaListAllReadings, pre-bound with typed arguments.

func WrapListDocumentPaths

func WrapListDocumentPaths() *metaquery.Builder

WrapListDocumentPaths returns a metaquery.Builder over MetaListDocumentPaths, pre-bound with typed arguments.

func WrapListDocumentSummaries

func WrapListDocumentSummaries() *metaquery.Builder

WARNING: ListDocumentSummaries ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListDocumentSummaries returns a metaquery.Builder over MetaListDocumentSummaries, pre-bound with typed arguments.

func WrapListFragmentTextByPage

func WrapListFragmentTextByPage(arg ListFragmentTextByPageParams) *metaquery.Builder

WARNING: ListFragmentTextByPage ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListFragmentTextByPage returns a metaquery.Builder over MetaListFragmentTextByPage, pre-bound with typed arguments.

func WrapListFragmentsForDoc

func WrapListFragmentsForDoc(docID int64) *metaquery.Builder

WARNING: ListFragmentsForDoc ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListFragmentsForDoc returns a metaquery.Builder over MetaListFragmentsForDoc, pre-bound with typed arguments.

func WrapListJobStages

func WrapListJobStages(jobID int64) *metaquery.Builder

WARNING: ListJobStages ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListJobStages returns a metaquery.Builder over MetaListJobStages, pre-bound with typed arguments.

func WrapListJobs

func WrapListJobs() *metaquery.Builder

WrapListJobs returns a metaquery.Builder over MetaListJobs, pre-bound with typed arguments.

func WrapListMediaByDoc

func WrapListMediaByDoc(docID int64) *metaquery.Builder

WARNING: ListMediaByDoc ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListMediaByDoc returns a metaquery.Builder over MetaListMediaByDoc, pre-bound with typed arguments.

func WrapListMediaByFragment

func WrapListMediaByFragment(fragmentID sql.NullInt64) *metaquery.Builder

WARNING: ListMediaByFragment ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListMediaByFragment returns a metaquery.Builder over MetaListMediaByFragment, pre-bound with typed arguments.

func WrapListOcrPagesByDoc

func WrapListOcrPagesByDoc(docID int64) *metaquery.Builder

WARNING: ListOcrPagesByDoc ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListOcrPagesByDoc returns a metaquery.Builder over MetaListOcrPagesByDoc, pre-bound with typed arguments.

func WrapListReadingsOfSource

func WrapListReadingsOfSource(sourceSha256 string) *metaquery.Builder

WARNING: ListReadingsOfSource ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapListReadingsOfSource returns a metaquery.Builder over MetaListReadingsOfSource, pre-bound with typed arguments.

func WrapListRunningJobOwners

func WrapListRunningJobOwners() *metaquery.Builder

WrapListRunningJobOwners returns a metaquery.Builder over MetaListRunningJobOwners, pre-bound with typed arguments.

func WrapListTombstones

func WrapListTombstones() *metaquery.Builder

WrapListTombstones returns a metaquery.Builder over MetaListTombstones, pre-bound with typed arguments.

func WrapListUnlanedPendingJobs

func WrapListUnlanedPendingJobs() *metaquery.Builder

WrapListUnlanedPendingJobs returns a metaquery.Builder over MetaListUnlanedPendingJobs, pre-bound with typed arguments.

func WrapMatchDocumentsLike

func WrapMatchDocumentsLike(arg MatchDocumentsLikeParams) *metaquery.Builder

WARNING: MatchDocumentsLike ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapMatchDocumentsLike returns a metaquery.Builder over MetaMatchDocumentsLike, pre-bound with typed arguments.

func WrapOcrEngineCountsByDoc

func WrapOcrEngineCountsByDoc(docID int64) *metaquery.Builder

WrapOcrEngineCountsByDoc returns a metaquery.Builder over MetaOcrEngineCountsByDoc, pre-bound with typed arguments.

func WrapRecentDoneDurations

func WrapRecentDoneDurations() *metaquery.Builder

WARNING: RecentDoneDurations ends in a top-level ORDER BY. Wrapping re-applies ordering at runtime, so .ApplyOrder(...) produces a doubled, nested sort that can defeat index use. Drop ORDER BY from the query and order via .ApplyOrder(...) instead. See benchmark/README.md. WrapRecentDoneDurations returns a metaquery.Builder over MetaRecentDoneDurations, pre-bound with typed arguments.

func WrapRetryJob

func WrapRetryJob(id int64) *metaquery.Builder

WrapRetryJob returns a metaquery.Builder over MetaRetryJob, pre-bound with typed arguments.

func WrapSetDocumentFrag

func WrapSetDocumentFrag(arg SetDocumentFragParams) *metaquery.Builder

WrapSetDocumentFrag returns a metaquery.Builder over MetaSetDocumentFrag, pre-bound with typed arguments.

func WrapSetDocumentHash

func WrapSetDocumentHash(arg SetDocumentHashParams) *metaquery.Builder

WrapSetDocumentHash returns a metaquery.Builder over MetaSetDocumentHash, pre-bound with typed arguments.

func WrapSetJobLane

func WrapSetJobLane(arg SetJobLaneParams) *metaquery.Builder

WrapSetJobLane returns a metaquery.Builder over MetaSetJobLane, pre-bound with typed arguments.

func WrapSetJobRunning

func WrapSetJobRunning(arg SetJobRunningParams) *metaquery.Builder

WrapSetJobRunning returns a metaquery.Builder over MetaSetJobRunning, pre-bound with typed arguments.

func WrapSetJobURL added in v0.6.0

func WrapSetJobURL(arg SetJobURLParams) *metaquery.Builder

WrapSetJobURL returns a metaquery.Builder over MetaSetJobURL, pre-bound with typed arguments.

func WrapUpsertDocument

func WrapUpsertDocument(arg UpsertDocumentParams) *metaquery.Builder

WrapUpsertDocument returns a metaquery.Builder over MetaUpsertDocument, pre-bound with typed arguments.

func WrapUpsertOcrPage

func WrapUpsertOcrPage(arg UpsertOcrPageParams) *metaquery.Builder

WrapUpsertOcrPage returns a metaquery.Builder over MetaUpsertOcrPage, pre-bound with typed arguments.

func WrapUpsertReading

func WrapUpsertReading(arg UpsertReadingParams) *metaquery.Builder

WrapUpsertReading returns a metaquery.Builder over MetaUpsertReading, pre-bound with typed arguments.

Types

type AbortJobParams

type AbortJobParams struct {
	Error      string `db:"error" derived:"ingest_jobs.error" json:"error"`
	FinishedAt int64  `db:"finished_at" derived:"ingest_jobs.finished_at" json:"finished_at"`
	ID         int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
}

type Attestation

type Attestation struct {
	ID        int64  `db:"id" derived:"attestations.id" json:"id"`
	Doc       string `db:"doc" derived:"attestations.doc" json:"doc"`
	Seq       int64  `db:"seq" derived:"attestations.seq" json:"seq"`
	Unit      string `db:"unit" derived:"attestations.unit" json:"unit"`
	Kind      string `db:"kind" derived:"attestations.kind" json:"kind"`
	Blanket   int64  `db:"blanket" derived:"attestations.blanket" json:"blanket"`
	Text      string `db:"text" derived:"attestations.text" json:"text"`
	Label     string `db:"label" derived:"attestations.label" json:"label"`
	Note      string `db:"note" derived:"attestations.note" json:"note"`
	Statement string `db:"statement" derived:"attestations.statement" json:"statement"`
	Payload   string `db:"payload" derived:"attestations.payload" json:"payload"`
	RuledBy   string `db:"ruled_by" derived:"attestations.ruled_by" json:"ruled_by"`
	Auth      string `db:"auth" derived:"attestations.auth" json:"auth"`
	RuledAt   string `db:"ruled_at" derived:"attestations.ruled_at" json:"ruled_at"`
}

type CompleteJobParams

type CompleteJobParams struct {
	Fragments  int64  `db:"fragments" derived:"ingest_jobs.fragments" json:"fragments"`
	Mode       string `db:"mode" derived:"ingest_jobs.mode" json:"mode"`
	FinishedAt int64  `db:"finished_at" derived:"ingest_jobs.finished_at" json:"finished_at"`
	ID         int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DocField

type DocField struct {
	DocID    int64  `db:"doc_id" derived:"doc_fields.doc_id" json:"doc_id"`
	Type     string `db:"type" derived:"doc_fields.type" json:"type"`
	Fields   string `db:"fields" derived:"doc_fields.fields" json:"fields"`
	Source   string `db:"source" derived:"doc_fields.source" json:"source"`
	Model    string `db:"model" derived:"doc_fields.model" json:"model"`
	At       int64  `db:"at" derived:"doc_fields.at" json:"at"`
	TextHash string `db:"text_hash" derived:"doc_fields.text_hash" json:"text_hash"`
	TypeHash string `db:"type_hash" derived:"doc_fields.type_hash" json:"type_hash"`
}

type DocType

type DocType struct {
	ID          int64  `db:"id" derived:"doc_types.id" json:"id"`
	Name        string `db:"name" derived:"doc_types.name" json:"name"`
	Description string `db:"description" derived:"doc_types.description" json:"description"`
	Prompt      string `db:"prompt" derived:"doc_types.prompt" json:"prompt"`
	Schema      string `db:"schema" derived:"doc_types.schema" json:"schema"`
	Gold        string `db:"gold" derived:"doc_types.gold" json:"gold"`
	Model       string `db:"model" derived:"doc_types.model" json:"model"`
	CreatedAt   int64  `db:"created_at" derived:"doc_types.created_at" json:"created_at"`
	UpdatedAt   int64  `db:"updated_at" derived:"doc_types.updated_at" json:"updated_at"`
}

type Document

type Document struct {
	ID             int64  `db:"id" derived:"documents.id" json:"id"`
	Path           string `db:"path" derived:"documents.path" json:"path"`
	Title          string `db:"title" derived:"documents.title" json:"title"`
	AddedAt        int64  `db:"added_at" derived:"documents.added_at" json:"added_at"`
	ContentHash    string `db:"content_hash" derived:"documents.content_hash" json:"content_hash"`
	FragMode       string `db:"frag_mode" derived:"documents.frag_mode" json:"frag_mode"`
	FragRecipe     string `db:"frag_recipe" derived:"documents.frag_recipe" json:"frag_recipe"`
	GenName        string `db:"gen_name" derived:"documents.gen_name" json:"gen_name"`
	GenSummary     string `db:"gen_summary" derived:"documents.gen_summary" json:"gen_summary"`
	GenKind        string `db:"gen_kind" derived:"documents.gen_kind" json:"gen_kind"`
	GenSource      string `db:"gen_source" derived:"documents.gen_source" json:"gen_source"`
	GenModel       string `db:"gen_model" derived:"documents.gen_model" json:"gen_model"`
	GenAt          int64  `db:"gen_at" derived:"documents.gen_at" json:"gen_at"`
	GenTextHash    string `db:"gen_text_hash" derived:"documents.gen_text_hash" json:"gen_text_hash"`
	GenContentTags string `db:"gen_content_tags" derived:"documents.gen_content_tags" json:"gen_content_tags"`
	GenRoleTags    string `db:"gen_role_tags" derived:"documents.gen_role_tags" json:"gen_role_tags"`
	GenDocType     string `db:"gen_doc_type" derived:"documents.gen_doc_type" json:"gen_doc_type"`
	Tags           string `db:"tags" derived:"documents.tags" json:"tags"`
}

type DocumentNote

type DocumentNote struct {
	ID        int64         `db:"id" derived:"document_notes.id" json:"id"`
	DocID     int64         `db:"doc_id" derived:"document_notes.doc_id" json:"doc_id"`
	Page      sql.NullInt64 `db:"page" derived:"document_notes.page" json:"page"`
	Body      string        `db:"body" derived:"document_notes.body" json:"body"`
	Author    string        `db:"author" derived:"document_notes.author" json:"author"`
	CreatedAt string        `db:"created_at" derived:"document_notes.created_at" json:"created_at"`
}

type EnqueueJobParams

type EnqueueJobParams struct {
	Url        string `db:"url" derived:"ingest_jobs.url" json:"url"`
	Title      string `db:"title" derived:"ingest_jobs.title" json:"title"`
	EnqueuedAt int64  `db:"enqueued_at" derived:"ingest_jobs.enqueued_at" json:"enqueued_at"`
}

type ExportFragmentsRow

type ExportFragmentsRow struct {
	Page      int64  `db:"page" derived:"fragments.page" json:"page"`
	Ord       int64  `db:"ord" derived:"fragments.ord" json:"ord"`
	Text      string `db:"text" derived:"fragments.text" json:"text"`
	StartOff  int64  `db:"start_off" derived:"fragments.start_off" json:"start_off"`
	EndOff    int64  `db:"end_off" derived:"fragments.end_off" json:"end_off"`
	PageSpans string `db:"page_spans" derived:"fragments.page_spans" json:"page_spans"`
	Vec       []byte `db:"vec" derived:"fragment_vectors.vec" json:"vec"`
}

type FailJobParams

type FailJobParams struct {
	Error      string `db:"error" derived:"ingest_jobs.error" json:"error"`
	FinishedAt int64  `db:"finished_at" derived:"ingest_jobs.finished_at" json:"finished_at"`
	ID         int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
}

type FindPathByHashParams

type FindPathByHashParams struct {
	ContentHash string `db:"content_hash" derived:"documents.content_hash" json:"content_hash"`
	Path        string `db:"path" derived:"documents.path" json:"path"`
}

type Fragment

type Fragment struct {
	ID        int64  `db:"id" derived:"fragments.id" json:"id"`
	DocID     int64  `db:"doc_id" derived:"fragments.doc_id" json:"doc_id"`
	Page      int64  `db:"page" derived:"fragments.page" json:"page"`
	Ord       int64  `db:"ord" derived:"fragments.ord" json:"ord"`
	Text      string `db:"text" derived:"fragments.text" json:"text"`
	StartOff  int64  `db:"start_off" derived:"fragments.start_off" json:"start_off"`
	EndOff    int64  `db:"end_off" derived:"fragments.end_off" json:"end_off"`
	StartLine int64  `db:"start_line" derived:"fragments.start_line" json:"start_line"`
	EndLine   int64  `db:"end_line" derived:"fragments.end_line" json:"end_line"`
	Symbol    string `db:"symbol" derived:"fragments.symbol" json:"symbol"`
	ContentID string `db:"content_id" derived:"fragments.content_id" json:"content_id"`
	TextKey   string `db:"text_key" derived:"fragments.text_key" json:"text_key"`
	PageSpans string `db:"page_spans" derived:"fragments.page_spans" json:"page_spans"`
	Origin    string `db:"origin" derived:"fragments.origin" json:"origin"`
}

type FragmentVector

type FragmentVector struct {
	FragmentID int64  `db:"fragment_id" derived:"fragment_vectors.fragment_id" json:"fragment_id"`
	Dim        int64  `db:"dim" derived:"fragment_vectors.dim" json:"dim"`
	Vec        []byte `db:"vec" derived:"fragment_vectors.vec" json:"vec"`
}

type FragmentsFt

type FragmentsFt struct {
	Text string `db:"text" derived:"fragments_fts.text" json:"text"`
}

type GetDocumentByPathRow

type GetDocumentByPathRow struct {
	ID      int64  `db:"id" derived:"documents.id" json:"id"`
	Path    string `db:"path" derived:"documents.path" json:"path"`
	Title   string `db:"title" derived:"documents.title" json:"title"`
	AddedAt int64  `db:"added_at" derived:"documents.added_at" json:"added_at"`
}

type GetDocumentFragRow

type GetDocumentFragRow struct {
	FragMode   string `db:"frag_mode" derived:"documents.frag_mode" json:"frag_mode"`
	FragRecipe string `db:"frag_recipe" derived:"documents.frag_recipe" json:"frag_recipe"`
}

type GetOldestPendingJobInLaneRow

type GetOldestPendingJobInLaneRow struct {
	ID         int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
	Url        string `db:"url" derived:"ingest_jobs.url" json:"url"`
	Title      string `db:"title" derived:"ingest_jobs.title" json:"title"`
	EnqueuedAt int64  `db:"enqueued_at" derived:"ingest_jobs.enqueued_at" json:"enqueued_at"`
}

type GetOldestPendingJobRow

type GetOldestPendingJobRow struct {
	ID         int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
	Url        string `db:"url" derived:"ingest_jobs.url" json:"url"`
	Title      string `db:"title" derived:"ingest_jobs.title" json:"title"`
	EnqueuedAt int64  `db:"enqueued_at" derived:"ingest_jobs.enqueued_at" json:"enqueued_at"`
}

type GetPageImagePathParams

type GetPageImagePathParams struct {
	Path string `db:"path" derived:"documents.path" json:"path"`
	Page int64  `db:"page" derived:"ocr_pages.page" json:"page"`
}

type IdentityJob

type IdentityJob struct {
	ID         int64  `db:"id" derived:"identity_jobs.id" json:"id"`
	Path       string `db:"path" derived:"identity_jobs.path" json:"path"`
	State      string `db:"state" derived:"identity_jobs.state" json:"state"`
	Force      int64  `db:"force" derived:"identity_jobs.force" json:"force"`
	Mode       string `db:"mode" derived:"identity_jobs.mode" json:"mode"`
	Error      string `db:"error" derived:"identity_jobs.error" json:"error"`
	EnqueuedAt int64  `db:"enqueued_at" derived:"identity_jobs.enqueued_at" json:"enqueued_at"`
	StartedAt  int64  `db:"started_at" derived:"identity_jobs.started_at" json:"started_at"`
	FinishedAt int64  `db:"finished_at" derived:"identity_jobs.finished_at" json:"finished_at"`
	OwnerPid   int64  `db:"owner_pid" derived:"identity_jobs.owner_pid" json:"owner_pid"`
}

type IndexMetum

type IndexMetum struct {
	Key       string `db:"key" derived:"index_meta.key" json:"key"`
	Value     string `db:"value" derived:"index_meta.value" json:"value"`
	UpdatedAt int64  `db:"updated_at" derived:"index_meta.updated_at" json:"updated_at"`
}

type IngestJob

type IngestJob struct {
	ID         int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
	Url        string `db:"url" derived:"ingest_jobs.url" json:"url"`
	Title      string `db:"title" derived:"ingest_jobs.title" json:"title"`
	State      string `db:"state" derived:"ingest_jobs.state" json:"state"`
	Error      string `db:"error" derived:"ingest_jobs.error" json:"error"`
	Fragments  int64  `db:"fragments" derived:"ingest_jobs.fragments" json:"fragments"`
	Mode       string `db:"mode" derived:"ingest_jobs.mode" json:"mode"`
	EnqueuedAt int64  `db:"enqueued_at" derived:"ingest_jobs.enqueued_at" json:"enqueued_at"`
	StartedAt  int64  `db:"started_at" derived:"ingest_jobs.started_at" json:"started_at"`
	FinishedAt int64  `db:"finished_at" derived:"ingest_jobs.finished_at" json:"finished_at"`
	OwnerPid   int64  `db:"owner_pid" derived:"ingest_jobs.owner_pid" json:"owner_pid"`
	Lane       string `db:"lane" derived:"ingest_jobs.lane" json:"lane"`
}

type InsertFragmentParams

type InsertFragmentParams struct {
	DocID     int64  `db:"doc_id" derived:"fragments.doc_id" json:"doc_id"`
	Page      int64  `db:"page" derived:"fragments.page" json:"page"`
	Ord       int64  `db:"ord" derived:"fragments.ord" json:"ord"`
	Text      string `db:"text" derived:"fragments.text" json:"text"`
	StartOff  int64  `db:"start_off" derived:"fragments.start_off" json:"start_off"`
	EndOff    int64  `db:"end_off" derived:"fragments.end_off" json:"end_off"`
	StartLine int64  `db:"start_line" derived:"fragments.start_line" json:"start_line"`
	EndLine   int64  `db:"end_line" derived:"fragments.end_line" json:"end_line"`
	Symbol    string `db:"symbol" derived:"fragments.symbol" json:"symbol"`
	PageSpans string `db:"page_spans" derived:"fragments.page_spans" json:"page_spans"`
	Origin    string `db:"origin" derived:"fragments.origin" json:"origin"`
}

type InsertMediaParams

type InsertMediaParams struct {
	DocID       int64         `db:"doc_id" derived:"media.doc_id" json:"doc_id"`
	Page        int64         `db:"page" derived:"media.page" json:"page"`
	Ord         int64         `db:"ord" derived:"media.ord" json:"ord"`
	Kind        string        `db:"kind" derived:"media.kind" json:"kind"`
	ImagePath   string        `db:"image_path" derived:"media.image_path" json:"image_path"`
	Bbox        string        `db:"bbox" derived:"media.bbox" json:"bbox"`
	Description string        `db:"description" derived:"media.description" json:"description"`
	FragmentID  sql.NullInt64 `db:"fragment_id" derived:"media.fragment_id" json:"fragment_id"`
}

type InsertMediaVectorParams

type InsertMediaVectorParams struct {
	MediaID int64  `db:"media_id" derived:"media_vectors.media_id" json:"media_id"`
	Dim     int64  `db:"dim" derived:"media_vectors.dim" json:"dim"`
	Vec     []byte `db:"vec" derived:"media_vectors.vec" json:"vec"`
	Space   string `db:"space" derived:"media_vectors.space" json:"space"`
}

type InsertStageParams

type InsertStageParams struct {
	JobID  int64  `db:"job_id" derived:"job_stages.job_id" json:"job_id"`
	Seq    int64  `db:"seq" derived:"job_stages.seq" json:"seq"`
	Name   string `db:"name" derived:"job_stages.name" json:"name"`
	Engine string `db:"engine" derived:"job_stages.engine" json:"engine"`
	State  string `db:"state" derived:"job_stages.state" json:"state"`
	Detail string `db:"detail" derived:"job_stages.detail" json:"detail"`
	At     int64  `db:"at" derived:"job_stages.at" json:"at"`
}

type InsertVectorParams

type InsertVectorParams struct {
	FragmentID int64  `db:"fragment_id" derived:"fragment_vectors.fragment_id" json:"fragment_id"`
	Dim        int64  `db:"dim" derived:"fragment_vectors.dim" json:"dim"`
	Vec        []byte `db:"vec" derived:"fragment_vectors.vec" json:"vec"`
}

type JobStage

type JobStage struct {
	ID     int64  `db:"id" derived:"job_stages.id" json:"id"`
	JobID  int64  `db:"job_id" derived:"job_stages.job_id" json:"job_id"`
	Seq    int64  `db:"seq" derived:"job_stages.seq" json:"seq"`
	Name   string `db:"name" derived:"job_stages.name" json:"name"`
	Engine string `db:"engine" derived:"job_stages.engine" json:"engine"`
	State  string `db:"state" derived:"job_stages.state" json:"state"`
	Detail string `db:"detail" derived:"job_stages.detail" json:"detail"`
	At     int64  `db:"at" derived:"job_stages.at" json:"at"`
}

type JobStateCountsRow

type JobStateCountsRow struct {
	State string `db:"state" derived:"ingest_jobs.state" json:"state"`
	N     int64  `db:"n" json:"n"`
}

type LaneQueueCountsRow

type LaneQueueCountsRow struct {
	Lane  string `db:"lane" derived:"ingest_jobs.lane" json:"lane"`
	State string `db:"state" derived:"ingest_jobs.state" json:"state"`
	N     int64  `db:"n" json:"n"`
}

type ListActiveJobsRow

type ListActiveJobsRow struct {
	ID    int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
	Url   string `db:"url" derived:"ingest_jobs.url" json:"url"`
	State string `db:"state" derived:"ingest_jobs.state" json:"state"`
}

type ListDocumentSummariesRow

type ListDocumentSummariesRow struct {
	ID        int64  `db:"id" derived:"documents.id" json:"id"`
	Path      string `db:"path" derived:"documents.path" json:"path"`
	Title     string `db:"title" derived:"documents.title" json:"title"`
	AddedAt   int64  `db:"added_at" derived:"documents.added_at" json:"added_at"`
	FragMode  string `db:"frag_mode" derived:"documents.frag_mode" json:"frag_mode"`
	Fragments int64  `db:"fragments" json:"fragments"`
}

type ListFragmentTextByPageParams

type ListFragmentTextByPageParams struct {
	DocID int64 `db:"doc_id" derived:"fragments.doc_id" json:"doc_id"`
	Page  int64 `db:"page" derived:"fragments.page" json:"page"`
}

type ListFragmentsForDocRow

type ListFragmentsForDocRow struct {
	Page     int64  `db:"page" derived:"fragments.page" json:"page"`
	Ord      int64  `db:"ord" derived:"fragments.ord" json:"ord"`
	Text     string `db:"text" derived:"fragments.text" json:"text"`
	StartOff int64  `db:"start_off" derived:"fragments.start_off" json:"start_off"`
	EndOff   int64  `db:"end_off" derived:"fragments.end_off" json:"end_off"`
}

type ListJobStagesRow

type ListJobStagesRow struct {
	ID     int64  `db:"id" derived:"job_stages.id" json:"id"`
	Seq    int64  `db:"seq" derived:"job_stages.seq" json:"seq"`
	Name   string `db:"name" derived:"job_stages.name" json:"name"`
	Engine string `db:"engine" derived:"job_stages.engine" json:"engine"`
	State  string `db:"state" derived:"job_stages.state" json:"state"`
	Detail string `db:"detail" derived:"job_stages.detail" json:"detail"`
	At     int64  `db:"at" derived:"job_stages.at" json:"at"`
}

type ListMediaByDocRow

type ListMediaByDocRow struct {
	Page        int64         `db:"page" derived:"media.page" json:"page"`
	Ord         int64         `db:"ord" derived:"media.ord" json:"ord"`
	Kind        string        `db:"kind" derived:"media.kind" json:"kind"`
	ImagePath   string        `db:"image_path" derived:"media.image_path" json:"image_path"`
	Bbox        string        `db:"bbox" derived:"media.bbox" json:"bbox"`
	Description string        `db:"description" derived:"media.description" json:"description"`
	FragmentID  sql.NullInt64 `db:"fragment_id" derived:"media.fragment_id" json:"fragment_id"`
}

type ListMediaByFragmentRow

type ListMediaByFragmentRow struct {
	Page        int64  `db:"page" derived:"media.page" json:"page"`
	Ord         int64  `db:"ord" derived:"media.ord" json:"ord"`
	Kind        string `db:"kind" derived:"media.kind" json:"kind"`
	ImagePath   string `db:"image_path" derived:"media.image_path" json:"image_path"`
	Bbox        string `db:"bbox" derived:"media.bbox" json:"bbox"`
	Description string `db:"description" derived:"media.description" json:"description"`
}

type ListOcrPagesByDocRow

type ListOcrPagesByDocRow struct {
	Page           int64  `db:"page" derived:"ocr_pages.page" json:"page"`
	Engine         string `db:"engine" derived:"ocr_pages.engine" json:"engine"`
	ImagePath      string `db:"image_path" derived:"ocr_pages.image_path" json:"image_path"`
	TextChars      int64  `db:"text_chars" derived:"ocr_pages.text_chars" json:"text_chars"`
	DescribedChars int64  `db:"described_chars" derived:"ocr_pages.described_chars" json:"described_chars"`
}

type ListRunningJobOwnersRow

type ListRunningJobOwnersRow struct {
	ID        int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
	Url       string `db:"url" derived:"ingest_jobs.url" json:"url"`
	OwnerPid  int64  `db:"owner_pid" derived:"ingest_jobs.owner_pid" json:"owner_pid"`
	StartedAt int64  `db:"started_at" derived:"ingest_jobs.started_at" json:"started_at"`
}

type ListUnlanedPendingJobsRow

type ListUnlanedPendingJobsRow struct {
	ID  int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
	Url string `db:"url" derived:"ingest_jobs.url" json:"url"`
}

type MatchDocumentsLikeParams

type MatchDocumentsLikeParams struct {
	Path  string `db:"path" derived:"documents.path" json:"path"`
	Title string `db:"title" derived:"documents.title" json:"title"`
}

type MatchDocumentsLikeRow

type MatchDocumentsLikeRow struct {
	Path  string `db:"path" derived:"documents.path" json:"path"`
	Title string `db:"title" derived:"documents.title" json:"title"`
}

type MediaVector

type MediaVector struct {
	MediaID int64  `db:"media_id" derived:"media_vectors.media_id" json:"media_id"`
	Dim     int64  `db:"dim" derived:"media_vectors.dim" json:"dim"`
	Vec     []byte `db:"vec" derived:"media_vectors.vec" json:"vec"`
	Space   string `db:"space" derived:"media_vectors.space" json:"space"`
}

type Medium

type Medium struct {
	ID          int64         `db:"id" derived:"media.id" json:"id"`
	DocID       int64         `db:"doc_id" derived:"media.doc_id" json:"doc_id"`
	Page        int64         `db:"page" derived:"media.page" json:"page"`
	Ord         int64         `db:"ord" derived:"media.ord" json:"ord"`
	Kind        string        `db:"kind" derived:"media.kind" json:"kind"`
	ImagePath   string        `db:"image_path" derived:"media.image_path" json:"image_path"`
	Bbox        string        `db:"bbox" derived:"media.bbox" json:"bbox"`
	Description string        `db:"description" derived:"media.description" json:"description"`
	FragmentID  sql.NullInt64 `db:"fragment_id" derived:"media.fragment_id" json:"fragment_id"`
}

type OcrEngineCountsByDocRow

type OcrEngineCountsByDocRow struct {
	Engine string `db:"engine" derived:"ocr_pages.engine" json:"engine"`
	N      int64  `db:"n" json:"n"`
}

type OcrPage

type OcrPage struct {
	DocID          int64  `db:"doc_id" derived:"ocr_pages.doc_id" json:"doc_id"`
	Page           int64  `db:"page" derived:"ocr_pages.page" json:"page"`
	Engine         string `db:"engine" derived:"ocr_pages.engine" json:"engine"`
	Model          string `db:"model" derived:"ocr_pages.model" json:"model"`
	Dpi            int64  `db:"dpi" derived:"ocr_pages.dpi" json:"dpi"`
	ImagePath      string `db:"image_path" derived:"ocr_pages.image_path" json:"image_path"`
	TextChars      int64  `db:"text_chars" derived:"ocr_pages.text_chars" json:"text_chars"`
	DescribedChars int64  `db:"described_chars" derived:"ocr_pages.described_chars" json:"described_chars"`
}

type OcrPageCache

type OcrPageCache struct {
	ImgSha    string `db:"img_sha" derived:"ocr_page_cache.img_sha" json:"img_sha"`
	Engine    string `db:"engine" derived:"ocr_page_cache.engine" json:"engine"`
	Text      string `db:"text" derived:"ocr_page_cache.text" json:"text"`
	CreatedAt int64  `db:"created_at" derived:"ocr_page_cache.created_at" json:"created_at"`
}

type PageReading

type PageReading struct {
	ID     int64  `db:"id" derived:"page_readings.id" json:"id"`
	Doc    string `db:"doc" derived:"page_readings.doc" json:"doc"`
	Page   int64  `db:"page" derived:"page_readings.page" json:"page"`
	Seq    int64  `db:"seq" derived:"page_readings.seq" json:"seq"`
	Text   string `db:"text" derived:"page_readings.text" json:"text"`
	Source string `db:"source" derived:"page_readings.source" json:"source"`
	Engine string `db:"engine" derived:"page_readings.engine" json:"engine"`
	Model  string `db:"model" derived:"page_readings.model" json:"model"`
	Note   string `db:"note" derived:"page_readings.note" json:"note"`
	ReadBy string `db:"read_by" derived:"page_readings.read_by" json:"read_by"`
	ReadAt string `db:"read_at" derived:"page_readings.read_at" json:"read_at"`
	Active int64  `db:"active" derived:"page_readings.active" json:"active"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AbortJob

func (q *Queries) AbortJob(ctx context.Context, arg AbortJobParams) (int64, error)

func (*Queries) CancelJob

func (q *Queries) CancelJob(ctx context.Context, id int64) (int64, error)

func (*Queries) CompleteJob

func (q *Queries) CompleteJob(ctx context.Context, arg CompleteJobParams) error

func (*Queries) CountDocuments

func (q *Queries) CountDocuments(ctx context.Context) (int64, error)

func (*Queries) CountFragments

func (q *Queries) CountFragments(ctx context.Context) (int64, error)

===== fragments =====

func (*Queries) DeleteDocumentByPath

func (q *Queries) DeleteDocumentByPath(ctx context.Context, path string) error

func (*Queries) DeleteFragmentsByDoc

func (q *Queries) DeleteFragmentsByDoc(ctx context.Context, docID int64) error

func (*Queries) DeleteMediaByDoc

func (q *Queries) DeleteMediaByDoc(ctx context.Context, docID int64) error

func (*Queries) DeleteOcrPagesByDoc

func (q *Queries) DeleteOcrPagesByDoc(ctx context.Context, docID int64) error

func (*Queries) DeleteTombstone

func (q *Queries) DeleteTombstone(ctx context.Context, path string) error

func (*Queries) EnqueueJob

func (q *Queries) EnqueueJob(ctx context.Context, arg EnqueueJobParams) (int64, error)

===== ingest_jobs =====

func (*Queries) ExportFragments

func (q *Queries) ExportFragments(ctx context.Context, docID int64) ([]ExportFragmentsRow, error)

func (*Queries) FailJob

func (q *Queries) FailJob(ctx context.Context, arg FailJobParams) error

func (*Queries) FindPathByHash

func (q *Queries) FindPathByHash(ctx context.Context, arg FindPathByHashParams) (string, error)

func (*Queries) GetDocumentByPath

func (q *Queries) GetDocumentByPath(ctx context.Context, path string) (GetDocumentByPathRow, error)

Relational CRUD for the raglit Store. FTS5 search + vector cosine are NOT here (sqlc can't parse fts5); they stay as raw SQL in store.go. ===== documents =====

func (*Queries) GetDocumentFrag

func (q *Queries) GetDocumentFrag(ctx context.Context, id int64) (GetDocumentFragRow, error)

func (*Queries) GetDocumentHash

func (q *Queries) GetDocumentHash(ctx context.Context, path string) (string, error)

===== content-hash dedup =====

func (*Queries) GetJob

func (q *Queries) GetJob(ctx context.Context, id int64) (IngestJob, error)

func (*Queries) GetOldestPendingJob

func (q *Queries) GetOldestPendingJob(ctx context.Context) (GetOldestPendingJobRow, error)

func (*Queries) GetOldestPendingJobInLane

func (q *Queries) GetOldestPendingJobInLane(ctx context.Context, lane string) (GetOldestPendingJobInLaneRow, error)

func (*Queries) GetPageImagePath

func (q *Queries) GetPageImagePath(ctx context.Context, arg GetPageImagePathParams) (string, error)

func (*Queries) GetReadingForDoc

func (q *Queries) GetReadingForDoc(ctx context.Context, docPath string) (Reading, error)

func (*Queries) InsertFragment

func (q *Queries) InsertFragment(ctx context.Context, arg InsertFragmentParams) (int64, error)

origin marks text nobody wrote: 'described' for a model's account of an image (indextext.go), 'identity' for a generated caption (identity.go). Empty is transcription, and the only kind that may be quoted as the record. content_id is not set here: setContentIDs writes it for the whole document, because a repeat's occurrence number depends on the fragments before it.

func (*Queries) InsertMedia

func (q *Queries) InsertMedia(ctx context.Context, arg InsertMediaParams) (int64, error)

===== media (figures explained into fragments) =====

func (*Queries) InsertMediaVector

func (q *Queries) InsertMediaVector(ctx context.Context, arg InsertMediaVectorParams) error

func (*Queries) InsertStage

func (q *Queries) InsertStage(ctx context.Context, arg InsertStageParams) error

===== job_stages =====

func (*Queries) InsertTombstone

func (q *Queries) InsertTombstone(ctx context.Context, path string) error

===== tombstones (branch storage) =====

func (*Queries) InsertVector

func (q *Queries) InsertVector(ctx context.Context, arg InsertVectorParams) error

===== fragment_vectors =====

func (*Queries) JobStateCounts

func (q *Queries) JobStateCounts(ctx context.Context) ([]JobStateCountsRow, error)

func (*Queries) LaneQueueCounts

func (q *Queries) LaneQueueCounts(ctx context.Context) ([]LaneQueueCountsRow, error)

func (*Queries) ListActiveJobs

func (q *Queries) ListActiveJobs(ctx context.Context) ([]ListActiveJobsRow, error)

func (*Queries) ListAllReadings

func (q *Queries) ListAllReadings(ctx context.Context) ([]Reading, error)

func (*Queries) ListDocumentPaths

func (q *Queries) ListDocumentPaths(ctx context.Context) ([]string, error)

func (*Queries) ListDocumentSummaries

func (q *Queries) ListDocumentSummaries(ctx context.Context) ([]ListDocumentSummariesRow, error)

func (*Queries) ListFragmentTextByPage

func (q *Queries) ListFragmentTextByPage(ctx context.Context, arg ListFragmentTextByPageParams) ([]string, error)

func (*Queries) ListFragmentsForDoc

func (q *Queries) ListFragmentsForDoc(ctx context.Context, docID int64) ([]ListFragmentsForDocRow, error)

func (*Queries) ListJobStages

func (q *Queries) ListJobStages(ctx context.Context, jobID int64) ([]ListJobStagesRow, error)

ORDER BY id, not seq. A retried job appends a WHOLE SECOND RUN of stages under the same job_id, and seq restarts at 1 each time — so ordering by seq interleaves the runs and the account becomes unreadable. Job 927 on the fence-dispute index is four runs, and read as "fetch, fetch, fetch, fetch, extract, extract, …" with no way to tell which failure belonged to which attempt. id is insertion order, which is chronological, which keeps a run together — and it is the only stable key a stage has, since (job_id, seq) names up to four rows.

func (*Queries) ListJobs

func (q *Queries) ListJobs(ctx context.Context) ([]IngestJob, error)

The projection must carry EVERY column of ingest_jobs. This is scanned into the full-table IngestJob struct through metaquery, which validates the two against each other and refuses a mismatch -- so adding a column to the table and not to this list does not silently drop a field, it breaks the jobs list outright with "shape mismatch: field IngestJob.Lane not in projection".

func (*Queries) ListMediaByDoc

func (q *Queries) ListMediaByDoc(ctx context.Context, docID int64) ([]ListMediaByDocRow, error)

func (*Queries) ListMediaByFragment

func (q *Queries) ListMediaByFragment(ctx context.Context, fragmentID sql.NullInt64) ([]ListMediaByFragmentRow, error)

func (*Queries) ListOcrPagesByDoc

func (q *Queries) ListOcrPagesByDoc(ctx context.Context, docID int64) ([]ListOcrPagesByDocRow, error)

func (*Queries) ListReadingsOfSource

func (q *Queries) ListReadingsOfSource(ctx context.Context, sourceSha256 string) ([]Reading, error)

func (*Queries) ListRunningJobOwners

func (q *Queries) ListRunningJobOwners(ctx context.Context) ([]ListRunningJobOwnersRow, error)

func (*Queries) ListTombstones

func (q *Queries) ListTombstones(ctx context.Context) ([]string, error)

func (*Queries) ListUnlanedPendingJobs

func (q *Queries) ListUnlanedPendingJobs(ctx context.Context) ([]ListUnlanedPendingJobsRow, error)

func (*Queries) MatchDocumentsLike

func (q *Queries) MatchDocumentsLike(ctx context.Context, arg MatchDocumentsLikeParams) ([]MatchDocumentsLikeRow, error)

func (*Queries) OcrEngineCountsByDoc

func (q *Queries) OcrEngineCountsByDoc(ctx context.Context, docID int64) ([]OcrEngineCountsByDocRow, error)

func (*Queries) RecentDoneDurations

func (q *Queries) RecentDoneDurations(ctx context.Context) ([]RecentDoneDurationsRow, error)

func (*Queries) RetryJob

func (q *Queries) RetryJob(ctx context.Context, id int64) (int64, error)

func (*Queries) SetDocumentFrag

func (q *Queries) SetDocumentFrag(ctx context.Context, arg SetDocumentFragParams) error

func (*Queries) SetDocumentHash

func (q *Queries) SetDocumentHash(ctx context.Context, arg SetDocumentHashParams) error

func (*Queries) SetJobLane

func (q *Queries) SetJobLane(ctx context.Context, arg SetJobLaneParams) error

func (*Queries) SetJobRunning

func (q *Queries) SetJobRunning(ctx context.Context, arg SetJobRunningParams) error

func (*Queries) SetJobURL

func (q *Queries) SetJobURL(ctx context.Context, arg SetJobURLParams) error

func (*Queries) UpsertDocument

func (q *Queries) UpsertDocument(ctx context.Context, arg UpsertDocumentParams) (int64, error)

func (*Queries) UpsertOcrPage

func (q *Queries) UpsertOcrPage(ctx context.Context, arg UpsertOcrPageParams) error

===== ocr_pages =====

func (*Queries) UpsertReading

func (q *Queries) UpsertReading(ctx context.Context, arg UpsertReadingParams) error

===== readings =====

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Reading

type Reading struct {
	ID           int64  `db:"id" derived:"readings.id" json:"id"`
	SourceSha256 string `db:"source_sha256" derived:"readings.source_sha256" json:"source_sha256"`
	SourcePath   string `db:"source_path" derived:"readings.source_path" json:"source_path"`
	DocPath      string `db:"doc_path" derived:"readings.doc_path" json:"doc_path"`
	Method       string `db:"method" derived:"readings.method" json:"method"`
	Level        string `db:"level" derived:"readings.level" json:"level"`
	ProducedBy   string `db:"produced_by" derived:"readings.produced_by" json:"produced_by"`
	RuledBy      string `db:"ruled_by" derived:"readings.ruled_by" json:"ruled_by"`
	At           int64  `db:"at" derived:"readings.at" json:"at"`
	Text         string `db:"text" derived:"readings.text" json:"text"`
	Data         string `db:"data" derived:"readings.data" json:"data"`
	Ruled        string `db:"ruled" derived:"readings.ruled" json:"ruled"`
	Describes    int64  `db:"describes" derived:"readings.describes" json:"describes"`
	DescribedPct int64  `db:"described_pct" derived:"readings.described_pct" json:"described_pct"`
}

type RecentDoneDurationsRow

type RecentDoneDurationsRow struct {
	StartedAt  int64 `db:"started_at" derived:"ingest_jobs.started_at" json:"started_at"`
	FinishedAt int64 `db:"finished_at" derived:"ingest_jobs.finished_at" json:"finished_at"`
}

type SetDocumentFragParams

type SetDocumentFragParams struct {
	FragMode   string `db:"frag_mode" derived:"documents.frag_mode" json:"frag_mode"`
	FragRecipe string `db:"frag_recipe" derived:"documents.frag_recipe" json:"frag_recipe"`
	ID         int64  `db:"id" derived:"documents.id" json:"id"`
}

type SetDocumentHashParams

type SetDocumentHashParams struct {
	ContentHash string `db:"content_hash" derived:"documents.content_hash" json:"content_hash"`
	Path        string `db:"path" derived:"documents.path" json:"path"`
}

type SetJobLaneParams

type SetJobLaneParams struct {
	Lane string `db:"lane" derived:"ingest_jobs.lane" json:"lane"`
	ID   int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
}

type SetJobRunningParams

type SetJobRunningParams struct {
	StartedAt int64 `db:"started_at" derived:"ingest_jobs.started_at" json:"started_at"`
	OwnerPid  int64 `db:"owner_pid" derived:"ingest_jobs.owner_pid" json:"owner_pid"`
	ID        int64 `db:"id" derived:"ingest_jobs.id" json:"id"`
}

type SetJobURLParams

type SetJobURLParams struct {
	Url string `db:"url" derived:"ingest_jobs.url" json:"url"`
	ID  int64  `db:"id" derived:"ingest_jobs.id" json:"id"`
}

type ShingleIndex

type ShingleIndex struct {
	Hash  int64 `db:"hash" derived:"shingle_index.hash" json:"hash"`
	DocID int64 `db:"doc_id" derived:"shingle_index.doc_id" json:"doc_id"`
	Page  int64 `db:"page" derived:"shingle_index.page" json:"page"`
}

type ShinglePage

type ShinglePage struct {
	DocID   int64  `db:"doc_id" derived:"shingle_pages.doc_id" json:"doc_id"`
	Page    int64  `db:"page" derived:"shingle_pages.page" json:"page"`
	Chars   int64  `db:"chars" derived:"shingle_pages.chars" json:"chars"`
	Total   int64  `db:"total" derived:"shingle_pages.total" json:"total"`
	Sampled int64  `db:"sampled" derived:"shingle_pages.sampled" json:"sampled"`
	Recipe  string `db:"recipe" derived:"shingle_pages.recipe" json:"recipe"`
}

type Tombstone

type Tombstone struct {
	Path string `db:"path" derived:"tombstones.path" json:"path"`
}

type UpsertDocumentParams

type UpsertDocumentParams struct {
	Path    string `db:"path" derived:"documents.path" json:"path"`
	Title   string `db:"title" derived:"documents.title" json:"title"`
	AddedAt int64  `db:"added_at" derived:"documents.added_at" json:"added_at"`
}

type UpsertOcrPageParams

type UpsertOcrPageParams struct {
	DocID          int64  `db:"doc_id" derived:"ocr_pages.doc_id" json:"doc_id"`
	Page           int64  `db:"page" derived:"ocr_pages.page" json:"page"`
	Engine         string `db:"engine" derived:"ocr_pages.engine" json:"engine"`
	ImagePath      string `db:"image_path" derived:"ocr_pages.image_path" json:"image_path"`
	TextChars      int64  `db:"text_chars" derived:"ocr_pages.text_chars" json:"text_chars"`
	DescribedChars int64  `db:"described_chars" derived:"ocr_pages.described_chars" json:"described_chars"`
}

type UpsertReadingParams

type UpsertReadingParams struct {
	SourceSha256 string `db:"source_sha256" derived:"readings.source_sha256" json:"source_sha256"`
	SourcePath   string `db:"source_path" derived:"readings.source_path" json:"source_path"`
	DocPath      string `db:"doc_path" derived:"readings.doc_path" json:"doc_path"`
	Method       string `db:"method" derived:"readings.method" json:"method"`
	Level        string `db:"level" derived:"readings.level" json:"level"`
	ProducedBy   string `db:"produced_by" derived:"readings.produced_by" json:"produced_by"`
	RuledBy      string `db:"ruled_by" derived:"readings.ruled_by" json:"ruled_by"`
	At           int64  `db:"at" derived:"readings.at" json:"at"`
	Text         string `db:"text" derived:"readings.text" json:"text"`
	Data         string `db:"data" derived:"readings.data" json:"data"`
	Ruled        string `db:"ruled" derived:"readings.ruled" json:"ruled"`
	Describes    int64  `db:"describes" derived:"readings.describes" json:"describes"`
	DescribedPct int64  `db:"described_pct" derived:"readings.described_pct" json:"described_pct"`
}

type Withdrawal

type Withdrawal struct {
	Path   string `db:"path" derived:"withdrawals.path" json:"path"`
	Reason string `db:"reason" derived:"withdrawals.reason" json:"reason"`
	ByWho  string `db:"by_who" derived:"withdrawals.by_who" json:"by_who"`
	At     string `db:"at" derived:"withdrawals.at" json:"at"`
}

Jump to

Keyboard shortcuts

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