Documentation
¶
Index ¶
- func Connect(path string, wordsPerMinute float64, resolveSlug func(string) string) *gorm.DB
- func FillSlugsFromPaths(db *gorm.DB, resolveSlug func(path string) string)
- func MigrateHighlightsToSlugPK(db *gorm.DB)
- func MigrateReadingsToSlugPK(db *gorm.DB)
- func TemplateEngine(viewsFS fs.FS, translator i18n.Translator) (*html.Engine, error)
- type NoEmail
- type SMTP
- type SMTPMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
resolveSlug maps a legacy document path (file ID) to its slug; required when upgrading an older database that stored paths. Pass nil for tests or fresh databases (no path-based tables).
func FillSlugsFromPaths ¶ added in v4.21.0
FillSlugsFromPaths updates empty slug fields in highlights and readings tables by resolving each path (document ID) to its slug via the given resolver. resolveSlug should return the document slug for a given path, or empty string if not found. For highlights, only runs if the table still has a path column (pre-migration).
func MigrateHighlightsToSlugPK ¶ added in v4.21.0
MigrateHighlightsToSlugPK migrates the highlights table from (user_id, path) to (user_id, slug) primary key. Run after FillSlugsFromPaths so slugs are populated. No-op if the table has already been migrated.
func MigrateReadingsToSlugPK ¶ added in v4.21.0
MigrateReadingsToSlugPK migrates the readings table from (user_id, path) to (user_id, slug) primary key. Run after FillSlugsFromPaths so slugs are populated. No-op if the table has already been migrated.