db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	ID         int64
	Checksum   string
	PageCount  int
	OCRPending bool
}

type DB

type DB struct {
	*sql.DB
}

func Open

func Open(path string) (*DB, error)

func (*DB) AllDocuments

func (db *DB) AllDocuments() ([]Document, error)

func (*DB) AllStats

func (db *DB) AllStats() (docCount int, totalPages int, err error)

func (*DB) CleanupOrphanContents

func (db *DB) CleanupOrphanContents() (int, error)

func (*DB) DeletePagesForContent

func (db *DB) DeletePagesForContent(contentID int64) error

func (*DB) GetContentByChecksum

func (db *DB) GetContentByChecksum(checksum string) (*Content, error)

func (*DB) GetDocumentByPath

func (db *DB) GetDocumentByPath(path string) (*Document, error)

func (*DB) GetDocumentPathForContent

func (db *DB) GetDocumentPathForContent(contentID int64) (string, error)

func (*DB) GetPageMarkdownByPathAndIndex

func (db *DB) GetPageMarkdownByPathAndIndex(path string, pageIndex int) (string, error)

func (*DB) GetPagesMarkdownByPathAndRange

func (db *DB) GetPagesMarkdownByPathAndRange(path string, startInclusive, endInclusive int) ([]PageRecord, error)

func (*DB) InsertContent

func (db *DB) InsertContent(checksum string, pageCount int) (int64, error)

func (*DB) InsertDocument

func (db *DB) InsertDocument(path string, contentID int64, createdAt, modifiedAt time.Time) (int64, error)

func (*DB) ListDocuments

func (db *DB) ListDocuments(opts ListOptions) ([]Document, error)

func (*DB) MarkContentOCRDone

func (db *DB) MarkContentOCRDone(contentID int64) error

func (*DB) PendingContents

func (db *DB) PendingContents() ([]Content, error)

func (*DB) PendingDocuments

func (db *DB) PendingDocuments() ([]Document, error)

func (*DB) PendingStats

func (db *DB) PendingStats() (docCount int, totalPages int, err error)

func (*DB) ReplaceContentPages

func (db *DB) ReplaceContentPages(contentID int64, pages []PageInput) (err error)

func (*DB) ResetAllDocuments

func (db *DB) ResetAllDocuments() (int, error)

func (*DB) RestoreDocument

func (db *DB) RestoreDocument(id int64, contentID int64, modifiedAt time.Time) error

func (*DB) Search

func (db *DB) Search(query string) ([]SearchResult, error)

func (*DB) SearchWithOptions

func (db *DB) SearchWithOptions(opts SearchOptions) ([]SearchResult, error)

func (*DB) SoftDeleteMissing

func (db *DB) SoftDeleteMissing(seenPaths map[string]bool, roots []string) (int, error)

func (*DB) UpdateDocument

func (db *DB) UpdateDocument(id int64, contentID int64, modifiedAt time.Time) error

func (*DB) UpsertPage

func (db *DB) UpsertPage(contentID int64, pageIndex int, markdown string) error

type Document

type Document struct {
	ID         int64
	Path       string
	ContentID  int64
	Checksum   string
	CreatedAt  time.Time
	ModifiedAt time.Time
	PageCount  int
	OCRPending bool
	Deleted    bool
}

type ListOptions

type ListOptions struct {
	After  *time.Time
	Before *time.Time
	Limit  int
	Offset int
}

type PageInput

type PageInput struct {
	PageIndex int
	Markdown  string
}

type PageRecord

type PageRecord struct {
	ID        int64
	ContentID int64
	PageIndex int
	Markdown  string
}

type SearchOptions

type SearchOptions struct {
	Query           string
	RawFTS          string
	Mode            string
	Limit           int
	Offset          int
	IncludePathLike bool
	UseTrigram      bool
}

type SearchResult

type SearchResult struct {
	Path         string
	PageIndex    int
	PageCount    int
	Snippet      string
	Rank         float64
	SearchSource string
}

Jump to

Keyboard shortcuts

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