chapters

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTables

func CreateTables(db *sql.DB) error

func FindChapterIDs

func FindChapterIDs(db *sql.DB, query Query) ([]int64, error)

func InsertChapter

func InsertChapter(db *sql.DB, chapter *Chapter) (int64, error)

func InsertChapterContent

func InsertChapterContent(db *sql.DB, filename string) (int64, error)

Types

type Chapter

type Chapter struct {
	ID               int64     `json:"id"`
	Filename         string    `json:"filename"`
	Title            string    `json:"title"`
	Toc              []TocItem `json:"toc"`
	KeyPoints        []string  `json:"keyPoints"`
	SummaryParagraph string    `json:"summaryParagraph"`
	Keywords         []string  `json:"keywords"`
	Sources          []Source  `json:"references"`
	CreatedAt        string    `json:"createdAt"`
	Comment          string    `json:"comment"`
}

func GetAllChapters

func GetAllChapters(db *sql.DB) ([]*Chapter, error)

func GetChapterByID

func GetChapterByID(db *sql.DB, id int64) (*Chapter, error)

func ReadChapterFromFile

func ReadChapterFromFile(filename string) (*Chapter, error)

type Query

type Query struct {
	Title     string   `json:"title"`
	Keywords  []string `json:"keywords"`
	TocItems  []string `json:"tocItems"`
	KeyPoints []string `json:"keyPoints"`
	Sources   []string `json:"sources"`
}

type Source

type Source struct {
	Author string `json:"author"`
	Source string `json:"source"`
}

type TocItem

type TocItem struct {
	Name  string `json:"name"`
	Level int    `json:"level"`
}

Jump to

Keyboard shortcuts

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