Documentation
¶
Index ¶
- Variables
- func CalculateUUID(time time.Time) (ulid.ULID, error)
- func DeleteDocument(docULIDSt string, db Repository) error
- func FetchAllDocuments(db Repository) (*[]Document, error)
- func FetchConfigFromDB(db Repository) (config.ServerConfig, error)
- func UpdateDocumentField(docULIDSt string, field string, newValue interface{}, db Repository) (int, error)
- func WriteConfigToDB(serverConfig config.ServerConfig, db Repository)
- type Dimension
- type DimensionValue
- type DimensionWithValues
- type Document
- func AddNewDocument(filePath string, fullText string, db Repository) (*Document, error)
- func FetchDocument(docULIDSt string, db Repository) (Document, int, error)
- func FetchDocumentFromPath(path string, db Repository) (Document, error)
- func FetchDocuments(docULIDSt []string, db Repository) ([]Document, int, error)
- func FetchFolder(folderName string, db Repository) ([]Document, error)
- func FetchNewestDocuments(numberOf int, db Repository) ([]Document, error)
- type DocumentDimension
- type DocumentMetadataUpdate
- type DocumentTag
- type DocumentTagsAndDimensions
- type DocumentWithTagsAndDimensions
- type EphemeralPostgresDB
- type Job
- type JobStatus
- type JobSummary
- type JobType
- type MemDB
- func (m *MemDB) AddDocumentToStory(documentID int, storyID int) error
- func (m *MemDB) AddStoryTag(storyID int, tagID int) error
- func (m *MemDB) AddTagToDocument(documentID int, tagID int) error
- func (m *MemDB) Close() error
- func (m *MemDB) CompleteJob(jobID ulid.ULID, result string) error
- func (m *MemDB) ConvertStoryToTag(storyID int) error
- func (m *MemDB) ConvertTagToStory(tagID int) (*Story, error)
- func (m *MemDB) CreateJob(jobType JobType, message string) (*Job, error)
- func (m *MemDB) CreateSavedSearch(search *SavedSearch) error
- func (m *MemDB) CreateStory(story *Story) error
- func (m *MemDB) CreateTag(tag *Tag) error
- func (m *MemDB) DeleteDocument(ulidStr string) error
- func (m *MemDB) DeleteOldJobs(olderThan time.Duration) (int, error)
- func (m *MemDB) DeleteSavedSearch(id int) error
- func (m *MemDB) DeleteStory(id int) error
- func (m *MemDB) DeleteTag(id int) error
- func (m *MemDB) ExecuteSearch(parsed *ParsedSearch, page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (m *MemDB) GetActiveJobs() ([]Job, error)
- func (m *MemDB) GetAllDimensions() ([]Dimension, error)
- func (m *MemDB) GetAllDocuments() ([]Document, error)
- func (m *MemDB) GetAllSavedSearches() ([]SavedSearch, error)
- func (m *MemDB) GetAllStories() ([]Story, error)
- func (m *MemDB) GetAllTagAliases() ([]TagAliasEntry, error)
- func (m *MemDB) GetAllTags() ([]Tag, error)
- func (m *MemDB) GetConfig() (*config.ServerConfig, error)
- func (m *MemDB) GetDimensionByID(id int) (*Dimension, error)
- func (m *MemDB) GetDimensionByName(name string) (*Dimension, error)
- func (m *MemDB) GetDimensionValueByValue(dimensionID int, value string) (*DimensionValue, error)
- func (m *MemDB) GetDimensionValues(dimensionID int) ([]DimensionValue, error)
- func (m *MemDB) GetDocumentByHash(hash string) (*Document, error)
- func (m *MemDB) GetDocumentByID(id int) (*Document, error)
- func (m *MemDB) GetDocumentByPath(path string) (*Document, error)
- func (m *MemDB) GetDocumentByULID(ulidStr string) (*Document, error)
- func (m *MemDB) GetDocumentDimensions(documentID int) (map[string]DimensionValue, error)
- func (m *MemDB) GetDocumentsByFolder(folder string) ([]Document, error)
- func (m *MemDB) GetDocumentsByTag(tagID int, page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (m *MemDB) GetDocumentsWithoutStory(page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (m *MemDB) GetJob(jobID ulid.ULID) (*Job, error)
- func (m *MemDB) GetNewestDocuments(limit int) ([]Document, error)
- func (m *MemDB) GetNewestDocumentsWithPagination(page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (m *MemDB) GetRecentJobs(limit, offset int) ([]Job, error)
- func (m *MemDB) GetSavedSearchByID(id int) (*SavedSearch, error)
- func (m *MemDB) GetSchemaVersion() (string, error)
- func (m *MemDB) GetStoriesWithMeta() ([]StoryWithMeta, error)
- func (m *MemDB) GetStoryByID(id int) (*Story, error)
- func (m *MemDB) GetStoryByTagID(tagID int) (*Story, error)
- func (m *MemDB) GetStoryTags(storyID int) ([]Tag, error)
- func (m *MemDB) GetTagByID(id int) (*Tag, error)
- func (m *MemDB) GetTagByName(name string) (*Tag, error)
- func (m *MemDB) GetTagGroups() ([]string, error)
- func (m *MemDB) GetTagUsageCount(tagID int) (int, error)
- func (m *MemDB) GetTaggedDocuments(page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (m *MemDB) GetTagsForDocument(documentID int) ([]Tag, error)
- func (m *MemDB) GetTopWords(limit int) ([]WordFrequency, error)
- func (m *MemDB) GetUntaggedDocuments(page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (m *MemDB) GetWordCloudMetadata() (*WordCloudMetadata, error)
- func (m *MemDB) InsertTagAlias(tagID int, aliasName string) error
- func (m *MemDB) RecalculateAllWordFrequencies() error
- func (m *MemDB) ReindexSearchDocuments() (int, error)
- func (m *MemDB) RemoveDocumentDimension(documentID int, dimensionID int) error
- func (m *MemDB) RemoveDocumentFromStory(documentID int, storyID int) error
- func (m *MemDB) RemoveStoryTag(storyID int, tagID int) error
- func (m *MemDB) RemoveTagFromDocument(documentID int, tagID int) error
- func (m *MemDB) SaveConfig(cfg *config.ServerConfig) error
- func (m *MemDB) SaveDocument(doc *Document) error
- func (m *MemDB) SearchDocuments(searchTerm string) ([]Document, error)
- func (m *MemDB) SetDocumentDimension(documentID int, dimensionID int, dimensionValueID int) error
- func (m *MemDB) UpdateDocumentDate(ulidStr string, date *time.Time) error
- func (m *MemDB) UpdateDocumentFolder(ulidStr string, folder string) error
- func (m *MemDB) UpdateDocumentFullText(ulidStr string, text string) error
- func (m *MemDB) UpdateDocumentMetadata(ulidStr string, meta DocumentMetadataUpdate) error
- func (m *MemDB) UpdateDocumentPath(ulidStr string, path string, folder string) error
- func (m *MemDB) UpdateDocumentURL(ulidStr string, url string) error
- func (m *MemDB) UpdateJobError(jobID ulid.ULID, errorMsg string) error
- func (m *MemDB) UpdateJobProgress(jobID ulid.ULID, progress int, currentStep string) error
- func (m *MemDB) UpdateJobStatus(jobID ulid.ULID, status JobStatus, message string) error
- func (m *MemDB) UpdateSavedSearch(search *SavedSearch) error
- func (m *MemDB) UpdateStory(story *Story) error
- func (m *MemDB) UpdateTag(tag *Tag) error
- func (m *MemDB) UpdateWordFrequencies(docID string) error
- type PGDB
- func (p *PGDB) AddDocumentToStory(documentID int, storyID int) error
- func (p *PGDB) AddStoryTag(storyID int, tagID int) error
- func (p *PGDB) AddTagToDocument(documentID int, tagID int) error
- func (p *PGDB) Close() error
- func (p *PGDB) CompleteJob(jobID ulid.ULID, result string) error
- func (p *PGDB) ConvertStoryToTag(storyID int) error
- func (p *PGDB) ConvertTagToStory(tagID int) (*Story, error)
- func (p *PGDB) CreateJob(jobType JobType, message string) (*Job, error)
- func (p *PGDB) CreateSavedSearch(search *SavedSearch) error
- func (p *PGDB) CreateStory(story *Story) error
- func (p *PGDB) CreateTag(tag *Tag) error
- func (p *PGDB) DeleteDocument(ulidStr string) error
- func (p *PGDB) DeleteOldJobs(olderThan time.Duration) (int, error)
- func (p *PGDB) DeleteSavedSearch(id int) error
- func (p *PGDB) DeleteStory(id int) error
- func (p *PGDB) DeleteTag(id int) error
- func (p *PGDB) ExecuteSearch(parsed *ParsedSearch, page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (p *PGDB) GetActiveJobs() ([]Job, error)
- func (p *PGDB) GetAllDimensions() ([]Dimension, error)
- func (p *PGDB) GetAllDocuments() ([]Document, error)
- func (p *PGDB) GetAllSavedSearches() ([]SavedSearch, error)
- func (p *PGDB) GetAllStories() ([]Story, error)
- func (p *PGDB) GetAllTagAliases() ([]TagAliasEntry, error)
- func (p *PGDB) GetAllTags() ([]Tag, error)
- func (p *PGDB) GetConfig() (*config.ServerConfig, error)
- func (p *PGDB) GetDimensionByID(id int) (*Dimension, error)
- func (p *PGDB) GetDimensionByName(name string) (*Dimension, error)
- func (p *PGDB) GetDimensionValueByValue(dimensionID int, value string) (*DimensionValue, error)
- func (p *PGDB) GetDimensionValues(dimensionID int) ([]DimensionValue, error)
- func (p *PGDB) GetDocumentByHash(hash string) (*Document, error)
- func (p *PGDB) GetDocumentByID(id int) (*Document, error)
- func (p *PGDB) GetDocumentByPath(path string) (*Document, error)
- func (p *PGDB) GetDocumentByULID(ulidStr string) (*Document, error)
- func (p *PGDB) GetDocumentDimensions(documentID int) (map[string]DimensionValue, error)
- func (p *PGDB) GetDocumentsByFolder(folder string) ([]Document, error)
- func (p *PGDB) GetDocumentsByTag(tagID int, page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (p *PGDB) GetDocumentsWithoutStory(page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (p *PGDB) GetJob(jobID ulid.ULID) (*Job, error)
- func (p *PGDB) GetNewestDocuments(limit int) ([]Document, error)
- func (p *PGDB) GetNewestDocumentsWithPagination(page int, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (p *PGDB) GetRecentJobs(limit, offset int) ([]Job, error)
- func (p *PGDB) GetSavedSearchByID(id int) (*SavedSearch, error)
- func (p *PGDB) GetSchemaVersion() (string, error)
- func (p *PGDB) GetStoriesWithMeta() ([]StoryWithMeta, error)
- func (p *PGDB) GetStoryByID(id int) (*Story, error)
- func (p *PGDB) GetStoryByTagID(tagID int) (*Story, error)
- func (p *PGDB) GetStoryTags(storyID int) ([]Tag, error)
- func (p *PGDB) GetTagByID(id int) (*Tag, error)
- func (p *PGDB) GetTagByName(name string) (*Tag, error)
- func (p *PGDB) GetTagGroups() ([]string, error)
- func (p *PGDB) GetTagUsageCount(tagID int) (int, error)
- func (p *PGDB) GetTaggedDocuments(page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (p *PGDB) GetTagsForDocument(documentID int) ([]Tag, error)
- func (p *PGDB) GetTopWords(limit int) ([]WordFrequency, error)
- func (p *PGDB) GetUntaggedDocuments(page, pageSize int, showHidden ...bool) ([]Document, int, error)
- func (p *PGDB) GetWordCloudMetadata() (*WordCloudMetadata, error)
- func (p *PGDB) InsertTagAlias(tagID int, aliasName string) error
- func (p *PGDB) RecalculateAllWordFrequencies() error
- func (p *PGDB) ReindexSearchDocuments() (int, error)
- func (p *PGDB) RemoveDocumentDimension(documentID int, dimensionID int) error
- func (p *PGDB) RemoveDocumentFromStory(documentID int, storyID int) error
- func (p *PGDB) RemoveStoryTag(storyID int, tagID int) error
- func (p *PGDB) RemoveTagFromDocument(documentID int, tagID int) error
- func (p *PGDB) SaveConfig(cfg *config.ServerConfig) error
- func (p *PGDB) SaveDocument(doc *Document) error
- func (p *PGDB) SearchDocuments(searchTerm string) ([]Document, error)
- func (p *PGDB) SetDocumentDimension(documentID int, dimensionID int, dimensionValueID int) error
- func (p *PGDB) UpdateDocumentDate(ulidStr string, date *time.Time) error
- func (p *PGDB) UpdateDocumentFolder(ulidStr string, folder string) error
- func (p *PGDB) UpdateDocumentFullText(ulidStr string, text string) error
- func (p *PGDB) UpdateDocumentMetadata(ulidStr string, meta DocumentMetadataUpdate) error
- func (p *PGDB) UpdateDocumentPath(ulidStr string, path string, folder string) error
- func (p *PGDB) UpdateDocumentURL(ulidStr string, url string) error
- func (p *PGDB) UpdateJobError(jobID ulid.ULID, errorMsg string) error
- func (p *PGDB) UpdateJobProgress(jobID ulid.ULID, progress int, currentStep string) error
- func (p *PGDB) UpdateJobStatus(jobID ulid.ULID, status JobStatus, message string) error
- func (p *PGDB) UpdateSavedSearch(search *SavedSearch) error
- func (p *PGDB) UpdateStory(story *Story) error
- func (p *PGDB) UpdateTag(tag *Tag) error
- func (p *PGDB) UpdateWordFrequencies(docID string) error
- type ParsedSearch
- type Repository
- type SavedSearch
- type SavedSearchWithCount
- type SearchResult
- type Story
- type StoryWithMeta
- type Tag
- type TagAliasEntry
- type TagWithCount
- type WordCloudMetadata
- type WordFrequency
- type WordTokenizer
Constants ¶
This section is empty.
Variables ¶
var Logger *slog.Logger
Logger is global since we will need it everywhere
Functions ¶
func CalculateUUID ¶
CalculateUUID for the incoming file
func DeleteDocument ¶
func DeleteDocument(docULIDSt string, db Repository) error
DeleteDocument fetches the requested document by ULID
func FetchAllDocuments ¶
func FetchAllDocuments(db Repository) (*[]Document, error)
FetchAllDocuments fetches all the documents in the database
func FetchConfigFromDB ¶
func FetchConfigFromDB(db Repository) (config.ServerConfig, error)
FetchConfigFromDB pulls the server config from the database
func UpdateDocumentField ¶
func UpdateDocumentField(docULIDSt string, field string, newValue interface{}, db Repository) (int, error)
UpdateDocumentField updates a single field in a document
func WriteConfigToDB ¶
func WriteConfigToDB(serverConfig config.ServerConfig, db Repository)
WriteConfigToDB writes the serverconfig to the database for later retrieval
Types ¶
type Dimension ¶ added in v0.21.4
type Dimension struct {
ID int `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description string `json:"description,omitempty"`
DimensionType string `json:"dimension_type"` // 'single' or 'multiple'
IsRequired bool `json:"is_required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Dimension represents a structured metadata category (e.g., Person, Location)
type DimensionValue ¶ added in v0.21.4
type DimensionValue struct {
ID int `json:"id"`
DimensionID int `json:"dimension_id"`
Value string `json:"value"`
DisplayName string `json:"display_name"`
Description string `json:"description,omitempty"`
Color string `json:"color"`
SortOrder int `json:"sort_order"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
DimensionValue represents an allowed value for a dimension
type DimensionWithValues ¶ added in v0.21.4
type DimensionWithValues struct {
Dimension
Values []DimensionValue `json:"values"`
}
DimensionWithValues includes the dimension and its possible values
type Document ¶
type Document struct {
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"path"` // full path to the file
IngressTime time.Time `json:"ingress_time"`
Folder string `json:"folder"`
Hash string `json:"hash"`
ULID ulid.ULID `json:"ulid"` // Have a smaller (than hash) id that can be used in URL's, hopefully speed things up
DocumentType string `json:"document_type"` // type of document (pdf, txt, etc)
FullText string `json:"full_text"`
URL string `json:"url"`
DocumentDate *time.Time `json:"document_date,omitempty"` // user-assigned document date (e.g. invoice date)
CreatedDate *time.Time `json:"created_date,omitempty"` // original creation date from source
UpdatedDate *time.Time `json:"updated_date,omitempty"` // original modification date from source
Author string `json:"author,omitempty"` // note author
SourceURL string `json:"source_url,omitempty"` // original source URL
Source string `json:"source,omitempty"` // source system (e.g. "evernote")
}
Document is all of the document information stored in the database
func AddNewDocument ¶
func AddNewDocument(filePath string, fullText string, db Repository) (*Document, error)
AddNewDocument adds a new document to the database
func FetchDocument ¶
func FetchDocument(docULIDSt string, db Repository) (Document, int, error)
FetchDocument fetches the requested document by ULID
func FetchDocumentFromPath ¶
func FetchDocumentFromPath(path string, db Repository) (Document, error)
FetchDocumentFromPath fetches the document by document path
func FetchDocuments ¶
func FetchDocuments(docULIDSt []string, db Repository) ([]Document, int, error)
FetchDocuments fetches an array of documents // TODO: Not fucking needed?
func FetchFolder ¶
func FetchFolder(folderName string, db Repository) ([]Document, error)
FetchFolder grabs all of the documents contained in a folder
func FetchNewestDocuments ¶
func FetchNewestDocuments(numberOf int, db Repository) ([]Document, error)
FetchNewestDocuments fetches the documents that were added last
type DocumentDimension ¶ added in v0.21.4
type DocumentDimension struct {
ID int `json:"id"`
DocumentID int `json:"document_id"`
DimensionID int `json:"dimension_id"`
DimensionValueID int `json:"dimension_value_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
DocumentDimension represents a dimension value assigned to a document
type DocumentMetadataUpdate ¶ added in v0.43.0
type DocumentMetadataUpdate struct {
CreatedDate *time.Time `json:"created_date,omitempty"`
UpdatedDate *time.Time `json:"updated_date,omitempty"`
Author *string `json:"author,omitempty"`
SourceURL *string `json:"source_url,omitempty"`
Source *string `json:"source,omitempty"`
}
DocumentMetadataUpdate holds optional fields for bulk metadata update via API. Pointer fields are omitted from the update when nil.
type DocumentTag ¶ added in v0.21.4
type DocumentTag struct {
DocumentID int `json:"document_id"`
TagID int `json:"tag_id"`
CreatedAt time.Time `json:"created_at"`
}
DocumentTag represents the many-to-many relationship between documents and tags
type DocumentTagsAndDimensions ¶ added in v0.21.4
type DocumentTagsAndDimensions struct {
Tags []string `json:"tags"` // Free tags (no group)
TagGroups map[string]string `json:"tag_groups,omitempty"` // group_name -> tag_name (one per group)
}
DocumentTagsAndDimensions is a helper struct for JSON sidecar files
type DocumentWithTagsAndDimensions ¶ added in v0.21.4
type DocumentWithTagsAndDimensions struct {
Document
Tags []Tag `json:"tags"`
Dimensions map[string]DimensionValue `json:"dimensions"` // dimension_name -> value
}
DocumentWithTagsAndDimensions extends Document with its tags and dimensions
type EphemeralPostgresDB ¶
type EphemeralPostgresDB struct {
*PGDB
// contains filtered or unexported fields
}
EphemeralPostgresDB wraps PGDB with an ephemeral PostgreSQL server for testing
type Job ¶
type Job struct {
ID ulid.ULID `json:"id"`
Type JobType `json:"type"`
Status JobStatus `json:"status"`
Progress int `json:"progress"` // 0-100
CurrentStep string `json:"currentStep"` // Human-readable current step
TotalSteps int `json:"totalSteps"` // Total number of steps
Message string `json:"message"` // Status message
Error string `json:"error,omitempty"` // Error message if failed
Result string `json:"result,omitempty"` // JSON result data
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
StartedAt *time.Time `json:"startedAt,omitempty"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
}
Job represents a background job or operation
type JobSummary ¶
type JobSummary struct {
FilesProcessed int `json:"filesProcessed"`
FilesTotal int `json:"filesTotal"`
BytesProcessed int64 `json:"bytesProcessed"`
Errors int `json:"errors"`
Details string `json:"details,omitempty"`
}
JobSummary provides summary statistics for a job
type MemDB ¶ added in v0.44.0
type MemDB struct {
// contains filtered or unexported fields
}
MemDB is a pure in-memory Repository implementation for WASM demos and testing. It requires no external dependencies (no SQL driver, no CGo).
func NewMemDB ¶ added in v0.44.0
func NewMemDB() *MemDB
NewMemDB creates a new in-memory repository.
func (*MemDB) AddDocumentToStory ¶ added in v0.44.0
func (*MemDB) AddStoryTag ¶ added in v0.44.0
func (*MemDB) AddTagToDocument ¶ added in v0.44.0
func (*MemDB) CompleteJob ¶ added in v0.44.0
func (*MemDB) ConvertStoryToTag ¶ added in v0.44.0
func (*MemDB) ConvertTagToStory ¶ added in v0.44.0
func (*MemDB) CreateSavedSearch ¶ added in v0.44.0
func (m *MemDB) CreateSavedSearch(search *SavedSearch) error
func (*MemDB) CreateStory ¶ added in v0.44.0
func (*MemDB) DeleteDocument ¶ added in v0.44.0
func (*MemDB) DeleteOldJobs ¶ added in v0.44.0
func (*MemDB) DeleteSavedSearch ¶ added in v0.44.0
func (*MemDB) DeleteStory ¶ added in v0.44.0
func (*MemDB) ExecuteSearch ¶ added in v0.44.0
func (*MemDB) GetActiveJobs ¶ added in v0.44.0
func (*MemDB) GetAllDimensions ¶ added in v0.44.0
func (*MemDB) GetAllDocuments ¶ added in v0.44.0
func (*MemDB) GetAllSavedSearches ¶ added in v0.44.0
func (m *MemDB) GetAllSavedSearches() ([]SavedSearch, error)
func (*MemDB) GetAllStories ¶ added in v0.44.0
func (*MemDB) GetAllTagAliases ¶ added in v0.44.0
func (m *MemDB) GetAllTagAliases() ([]TagAliasEntry, error)
func (*MemDB) GetAllTags ¶ added in v0.44.0
func (*MemDB) GetConfig ¶ added in v0.44.0
func (m *MemDB) GetConfig() (*config.ServerConfig, error)
func (*MemDB) GetDimensionByID ¶ added in v0.44.0
func (*MemDB) GetDimensionByName ¶ added in v0.44.0
func (*MemDB) GetDimensionValueByValue ¶ added in v0.44.0
func (m *MemDB) GetDimensionValueByValue(dimensionID int, value string) (*DimensionValue, error)
func (*MemDB) GetDimensionValues ¶ added in v0.44.0
func (m *MemDB) GetDimensionValues(dimensionID int) ([]DimensionValue, error)
func (*MemDB) GetDocumentByHash ¶ added in v0.44.0
func (*MemDB) GetDocumentByID ¶ added in v0.44.0
func (*MemDB) GetDocumentByPath ¶ added in v0.44.0
func (*MemDB) GetDocumentByULID ¶ added in v0.44.0
func (*MemDB) GetDocumentDimensions ¶ added in v0.44.0
func (m *MemDB) GetDocumentDimensions(documentID int) (map[string]DimensionValue, error)
func (*MemDB) GetDocumentsByFolder ¶ added in v0.44.0
func (*MemDB) GetDocumentsByTag ¶ added in v0.44.0
func (*MemDB) GetDocumentsWithoutStory ¶ added in v0.44.0
func (*MemDB) GetNewestDocuments ¶ added in v0.44.0
func (*MemDB) GetNewestDocumentsWithPagination ¶ added in v0.44.0
func (*MemDB) GetRecentJobs ¶ added in v0.44.0
func (*MemDB) GetSavedSearchByID ¶ added in v0.44.0
func (m *MemDB) GetSavedSearchByID(id int) (*SavedSearch, error)
func (*MemDB) GetSchemaVersion ¶ added in v0.44.0
func (*MemDB) GetStoriesWithMeta ¶ added in v0.44.0
func (m *MemDB) GetStoriesWithMeta() ([]StoryWithMeta, error)
func (*MemDB) GetStoryByTagID ¶ added in v0.44.0
func (*MemDB) GetStoryTags ¶ added in v0.44.0
func (*MemDB) GetTagByName ¶ added in v0.44.0
func (*MemDB) GetTagGroups ¶ added in v0.44.0
func (*MemDB) GetTagUsageCount ¶ added in v0.44.0
func (*MemDB) GetTaggedDocuments ¶ added in v0.44.0
func (*MemDB) GetTagsForDocument ¶ added in v0.44.0
func (*MemDB) GetTopWords ¶ added in v0.44.0
func (m *MemDB) GetTopWords(limit int) ([]WordFrequency, error)
func (*MemDB) GetUntaggedDocuments ¶ added in v0.44.0
func (*MemDB) GetWordCloudMetadata ¶ added in v0.44.0
func (m *MemDB) GetWordCloudMetadata() (*WordCloudMetadata, error)
func (*MemDB) InsertTagAlias ¶ added in v0.44.0
func (*MemDB) RecalculateAllWordFrequencies ¶ added in v0.44.0
func (*MemDB) ReindexSearchDocuments ¶ added in v0.44.0
func (*MemDB) RemoveDocumentDimension ¶ added in v0.44.0
func (*MemDB) RemoveDocumentFromStory ¶ added in v0.44.0
func (*MemDB) RemoveStoryTag ¶ added in v0.44.0
func (*MemDB) RemoveTagFromDocument ¶ added in v0.44.0
func (*MemDB) SaveConfig ¶ added in v0.44.0
func (m *MemDB) SaveConfig(cfg *config.ServerConfig) error
func (*MemDB) SaveDocument ¶ added in v0.44.0
func (*MemDB) SearchDocuments ¶ added in v0.44.0
func (*MemDB) SetDocumentDimension ¶ added in v0.44.0
func (*MemDB) UpdateDocumentDate ¶ added in v0.44.0
func (*MemDB) UpdateDocumentFolder ¶ added in v0.44.0
func (*MemDB) UpdateDocumentFullText ¶ added in v0.44.0
func (*MemDB) UpdateDocumentMetadata ¶ added in v0.44.0
func (m *MemDB) UpdateDocumentMetadata(ulidStr string, meta DocumentMetadataUpdate) error
func (*MemDB) UpdateDocumentPath ¶ added in v0.44.0
func (*MemDB) UpdateDocumentURL ¶ added in v0.44.0
func (*MemDB) UpdateJobError ¶ added in v0.44.0
func (*MemDB) UpdateJobProgress ¶ added in v0.44.0
func (*MemDB) UpdateJobStatus ¶ added in v0.44.0
func (*MemDB) UpdateSavedSearch ¶ added in v0.44.0
func (m *MemDB) UpdateSavedSearch(search *SavedSearch) error
func (*MemDB) UpdateStory ¶ added in v0.44.0
func (*MemDB) UpdateWordFrequencies ¶ added in v0.44.0
type PGDB ¶ added in v0.37.0
type PGDB struct {
// contains filtered or unexported fields
}
PGDB implements Repository using database/sql with raw PostgreSQL SQL. For production it connects via lib/pq; for dev/testing via go-postgres ("pglike") which transparently translates PostgreSQL SQL to SQLite.
func NewRepository ¶
func NewRepository(cfg config.ServerConfig) *PGDB
NewRepository initializes the database based on configuration
func SetupEphemeralPostgresDatabase ¶
SetupEphemeralPostgresDatabase creates an ephemeral PostgreSQL instance
func (*PGDB) AddDocumentToStory ¶ added in v0.42.0
AddDocumentToStory adds the story's tag (and all associated tags) to a document.
func (*PGDB) AddStoryTag ¶ added in v0.42.0
AddStoryTag adds an associated tag to a story.
func (*PGDB) AddTagToDocument ¶ added in v0.37.0
AddTagToDocument associates a tag with a document
func (*PGDB) CompleteJob ¶ added in v0.37.0
CompleteJob marks a job as completed with optional result data
func (*PGDB) ConvertStoryToTag ¶ added in v0.43.1
ConvertStoryToTag removes the story but keeps the tag and all document associations. Clears the tag's "Story" group.
func (*PGDB) ConvertTagToStory ¶ added in v0.43.1
ConvertTagToStory creates a story from an existing tag. Sets the tag's group to "Story" and creates a story row linked to it.
func (*PGDB) CreateSavedSearch ¶ added in v0.37.0
func (p *PGDB) CreateSavedSearch(search *SavedSearch) error
CreateSavedSearch creates a new saved search
func (*PGDB) CreateStory ¶ added in v0.42.0
CreateStory creates a new story and its associated tag in a transaction. The tag is created with tag_group='Story' and name derived from the title.
func (*PGDB) DeleteDocument ¶ added in v0.37.0
DeleteDocument deletes a document by ULID
func (*PGDB) DeleteOldJobs ¶ added in v0.37.0
DeleteOldJobs deletes completed jobs older than the specified duration
func (*PGDB) DeleteSavedSearch ¶ added in v0.37.0
DeleteSavedSearch deletes a saved search by ID
func (*PGDB) DeleteStory ¶ added in v0.42.0
DeleteStory deletes a story and its associated tag (cascade cleans document_tags).
func (*PGDB) DeleteTag ¶ added in v0.37.0
DeleteTag deletes a tag (cascade removes document associations)
func (*PGDB) ExecuteSearch ¶ added in v0.37.0
func (p *PGDB) ExecuteSearch(parsed *ParsedSearch, page, pageSize int, showHidden ...bool) ([]Document, int, error)
ExecuteSearch executes a parsed search query and returns paginated results
func (*PGDB) GetActiveJobs ¶ added in v0.37.0
GetActiveJobs retrieves all running or pending jobs
func (*PGDB) GetAllDimensions ¶ added in v0.37.0
GetAllDimensions returns all dimension definitions
func (*PGDB) GetAllDocuments ¶ added in v0.37.0
GetAllDocuments retrieves all documents
func (*PGDB) GetAllSavedSearches ¶ added in v0.37.0
func (p *PGDB) GetAllSavedSearches() ([]SavedSearch, error)
GetAllSavedSearches returns all saved searches sorted by sort_order
func (*PGDB) GetAllStories ¶ added in v0.42.0
GetAllStories returns all stories ordered by start_date descending.
func (*PGDB) GetAllTagAliases ¶ added in v0.43.4
func (p *PGDB) GetAllTagAliases() ([]TagAliasEntry, error)
GetAllTagAliases returns all tag aliases with resolved tag names
func (*PGDB) GetAllTags ¶ added in v0.37.0
GetAllTags returns all tags sorted by group and sort_order Uses CASE WHEN workaround for NULLS FIRST (not yet supported by go-postgres)
func (*PGDB) GetConfig ¶ added in v0.37.0
func (p *PGDB) GetConfig() (*config.ServerConfig, error)
GetConfig retrieves server configuration
func (*PGDB) GetDimensionByID ¶ added in v0.37.0
GetDimensionByID returns a dimension by its ID
func (*PGDB) GetDimensionByName ¶ added in v0.37.0
GetDimensionByName returns a dimension by its name
func (*PGDB) GetDimensionValueByValue ¶ added in v0.37.0
func (p *PGDB) GetDimensionValueByValue(dimensionID int, value string) (*DimensionValue, error)
GetDimensionValueByValue returns a dimension value by dimension ID and value string
func (*PGDB) GetDimensionValues ¶ added in v0.37.0
func (p *PGDB) GetDimensionValues(dimensionID int) ([]DimensionValue, error)
GetDimensionValues returns all possible values for a dimension
func (*PGDB) GetDocumentByHash ¶ added in v0.37.0
GetDocumentByHash retrieves a document by hash
func (*PGDB) GetDocumentByID ¶ added in v0.37.0
GetDocumentByID retrieves a document by ID
func (*PGDB) GetDocumentByPath ¶ added in v0.37.0
GetDocumentByPath retrieves a document by file path
func (*PGDB) GetDocumentByULID ¶ added in v0.37.0
GetDocumentByULID retrieves a document by ULID
func (*PGDB) GetDocumentDimensions ¶ added in v0.37.0
func (p *PGDB) GetDocumentDimensions(documentID int) (map[string]DimensionValue, error)
GetDocumentDimensions returns all dimension values assigned to a document
func (*PGDB) GetDocumentsByFolder ¶ added in v0.37.0
GetDocumentsByFolder retrieves documents in a specific folder
func (*PGDB) GetDocumentsByTag ¶ added in v0.37.0
func (p *PGDB) GetDocumentsByTag(tagID int, page, pageSize int, showHidden ...bool) ([]Document, int, error)
GetDocumentsByTag returns paginated documents that have a specific tag
func (*PGDB) GetDocumentsWithoutStory ¶ added in v0.42.0
func (p *PGDB) GetDocumentsWithoutStory(page, pageSize int, showHidden ...bool) ([]Document, int, error)
GetDocumentsWithoutStory returns documents that don't belong to any story, paginated and ordered by newest first.
func (*PGDB) GetNewestDocuments ¶ added in v0.37.0
GetNewestDocuments retrieves the newest documents
func (*PGDB) GetNewestDocumentsWithPagination ¶ added in v0.37.0
func (p *PGDB) GetNewestDocumentsWithPagination(page int, pageSize int, showHidden ...bool) ([]Document, int, error)
GetNewestDocumentsWithPagination retrieves documents with pagination support
func (*PGDB) GetRecentJobs ¶ added in v0.37.0
GetRecentJobs retrieves the most recent jobs with pagination
func (*PGDB) GetSavedSearchByID ¶ added in v0.37.0
func (p *PGDB) GetSavedSearchByID(id int) (*SavedSearch, error)
GetSavedSearchByID returns a saved search by its ID
func (*PGDB) GetSchemaVersion ¶ added in v0.37.0
GetSchemaVersion returns the latest applied migration version
func (*PGDB) GetStoriesWithMeta ¶ added in v0.42.0
func (p *PGDB) GetStoriesWithMeta() ([]StoryWithMeta, error)
GetStoriesWithMeta returns all stories with their tags, associated tags, and document counts.
func (*PGDB) GetStoryByID ¶ added in v0.42.0
GetStoryByID returns a story by its ID.
func (*PGDB) GetStoryByTagID ¶ added in v0.42.0
GetStoryByTagID returns a story by its tag ID.
func (*PGDB) GetStoryTags ¶ added in v0.42.0
GetStoryTags returns the associated tags for a story (from story_tags junction).
func (*PGDB) GetTagByID ¶ added in v0.37.0
GetTagByID returns a tag by its ID
func (*PGDB) GetTagByName ¶ added in v0.37.0
GetTagByName returns a tag by its name, falling back to alias lookup
func (*PGDB) GetTagGroups ¶ added in v0.37.0
GetTagGroups returns all distinct tag group names
func (*PGDB) GetTagUsageCount ¶ added in v0.37.0
GetTagUsageCount returns the number of documents using a specific tag
func (*PGDB) GetTaggedDocuments ¶ added in v0.40.2
GetTaggedDocuments returns paginated documents that have at least one tag
func (*PGDB) GetTagsForDocument ¶ added in v0.37.0
GetTagsForDocument returns all tags associated with a document
func (*PGDB) GetTopWords ¶ added in v0.37.0
func (p *PGDB) GetTopWords(limit int) ([]WordFrequency, error)
GetTopWords retrieves the top N most frequent words
func (*PGDB) GetUntaggedDocuments ¶ added in v0.37.0
func (p *PGDB) GetUntaggedDocuments(page, pageSize int, showHidden ...bool) ([]Document, int, error)
GetUntaggedDocuments returns paginated documents that have no tags
func (*PGDB) GetWordCloudMetadata ¶ added in v0.37.0
func (p *PGDB) GetWordCloudMetadata() (*WordCloudMetadata, error)
GetWordCloudMetadata retrieves metadata about the word cloud
func (*PGDB) InsertTagAlias ¶ added in v0.43.4
InsertTagAlias inserts a tag alias (does nothing on conflict)
func (*PGDB) RecalculateAllWordFrequencies ¶ added in v0.37.0
RecalculateAllWordFrequencies performs a full recalculation of word frequencies
func (*PGDB) ReindexSearchDocuments ¶ added in v0.37.0
ReindexSearchDocuments reindexes all documents for full-text search
func (*PGDB) RemoveDocumentDimension ¶ added in v0.37.0
RemoveDocumentDimension removes a dimension value from a document
func (*PGDB) RemoveDocumentFromStory ¶ added in v0.42.0
RemoveDocumentFromStory removes only the story tag from a document. Associated tags remain (they were applied upfront).
func (*PGDB) RemoveStoryTag ¶ added in v0.42.0
RemoveStoryTag removes an associated tag from a story.
func (*PGDB) RemoveTagFromDocument ¶ added in v0.37.0
RemoveTagFromDocument removes a tag association from a document
func (*PGDB) SaveConfig ¶ added in v0.37.0
func (p *PGDB) SaveConfig(cfg *config.ServerConfig) error
SaveConfig saves server configuration
func (*PGDB) SaveDocument ¶ added in v0.37.0
SaveDocument saves or updates a document
func (*PGDB) SearchDocuments ¶ added in v0.37.0
SearchDocuments performs full-text search
func (*PGDB) SetDocumentDimension ¶ added in v0.37.0
SetDocumentDimension sets a dimension value for a document (replaces existing)
func (*PGDB) UpdateDocumentDate ¶ added in v0.41.0
UpdateDocumentDate updates the document_date field of a document
func (*PGDB) UpdateDocumentFolder ¶ added in v0.37.0
UpdateDocumentFolder updates the Folder field of a document
func (*PGDB) UpdateDocumentFullText ¶ added in v0.42.1
UpdateDocumentFullText updates the full_text field of a document
func (*PGDB) UpdateDocumentMetadata ¶ added in v0.43.0
func (p *PGDB) UpdateDocumentMetadata(ulidStr string, meta DocumentMetadataUpdate) error
UpdateDocumentMetadata updates multiple metadata fields in a single query. Only non-nil fields in the update struct are applied.
func (*PGDB) UpdateDocumentPath ¶ added in v0.42.1
UpdateDocumentPath updates the path and folder fields of a document
func (*PGDB) UpdateDocumentURL ¶ added in v0.37.0
UpdateDocumentURL updates the URL field of a document
func (*PGDB) UpdateJobError ¶ added in v0.37.0
UpdateJobError updates a job with an error
func (*PGDB) UpdateJobProgress ¶ added in v0.37.0
UpdateJobProgress updates the progress of a job
func (*PGDB) UpdateJobStatus ¶ added in v0.37.0
UpdateJobStatus updates the status of a job
func (*PGDB) UpdateSavedSearch ¶ added in v0.37.0
func (p *PGDB) UpdateSavedSearch(search *SavedSearch) error
UpdateSavedSearch updates an existing saved search
func (*PGDB) UpdateStory ¶ added in v0.42.0
UpdateStory updates a story's title, description, dates, and syncs tag name/color.
func (*PGDB) UpdateTag ¶ added in v0.37.0
UpdateTag updates an existing tag. If the name changed, the old name is saved as an alias so that .tags.json sidecars with the old name still resolve.
func (*PGDB) UpdateWordFrequencies ¶ added in v0.37.0
UpdateWordFrequencies updates word frequencies after document ingestion
type ParsedSearch ¶ added in v0.34.0
type ParsedSearch struct {
TextTerms string // Free text to search for
IncludeTags []string // Tags to include (prefixed with #)
ExcludeTags []string // Tags to exclude (prefixed with ~)
IsUntagged bool // Special: show only untagged documents
IsTagged bool // Special: show only tagged documents
IsAllDocs bool // Special: show all documents
AfterDate *time.Time // Filter: document_date >= this (inclusive)
BeforeDate *time.Time // Filter: document_date <= this (inclusive)
}
ParsedSearch represents a parsed search query
func ParseSearchQuery ¶ added in v0.34.0
func ParseSearchQuery(query string) *ParsedSearch
ParseSearchQuery parses a unified search query string Syntax:
- text: full-text search terms
- #tagname: include documents with this tag
- ~tagname: exclude documents with this tag
- Special: "*" means all documents
- Special: "!untagged" means only untagged documents
Examples:
- "cancer" -> text search for "cancer"
- "#Invoice" -> documents with Invoice tag
- "~2025" -> documents without 2025 tag
- "cancer #Invoice ~Draft" -> text "cancer", has Invoice, no Draft
type Repository ¶
type Repository interface {
Close() error
SaveDocument(doc *Document) error
GetDocumentByID(id int) (*Document, error)
GetDocumentByULID(ulid string) (*Document, error)
GetDocumentByPath(path string) (*Document, error)
GetDocumentByHash(hash string) (*Document, error)
GetNewestDocuments(limit int) ([]Document, error)
GetNewestDocumentsWithPagination(page int, pageSize int, showHidden ...bool) ([]Document, int, error)
GetAllDocuments() ([]Document, error)
GetDocumentsByFolder(folder string) ([]Document, error)
DeleteDocument(ulid string) error
UpdateDocumentURL(ulid string, url string) error
UpdateDocumentPath(ulid string, path string, folder string) error
UpdateDocumentFolder(ulid string, folder string) error
UpdateDocumentDate(ulid string, date *time.Time) error
UpdateDocumentFullText(ulid string, text string) error
SaveConfig(config *config.ServerConfig) error
GetConfig() (*config.ServerConfig, error)
SearchDocuments(searchTerm string) ([]Document, error)
ReindexSearchDocuments() (int, error)
// Word cloud methods
GetTopWords(limit int) ([]WordFrequency, error)
GetWordCloudMetadata() (*WordCloudMetadata, error)
RecalculateAllWordFrequencies() error
UpdateWordFrequencies(docID string) error
// Job tracking methods
CreateJob(jobType JobType, message string) (*Job, error)
UpdateJobProgress(jobID ulid.ULID, progress int, currentStep string) error
UpdateJobStatus(jobID ulid.ULID, status JobStatus, message string) error
UpdateJobError(jobID ulid.ULID, errorMsg string) error
CompleteJob(jobID ulid.ULID, result string) error
GetJob(jobID ulid.ULID) (*Job, error)
GetRecentJobs(limit, offset int) ([]Job, error)
GetActiveJobs() ([]Job, error)
DeleteOldJobs(olderThan time.Duration) (int, error)
// Tag methods
CreateTag(tag *Tag) error
GetAllTags() ([]Tag, error)
GetTagByID(id int) (*Tag, error)
GetTagByName(name string) (*Tag, error)
UpdateTag(tag *Tag) error
DeleteTag(id int) error
GetTagsForDocument(documentID int) ([]Tag, error)
AddTagToDocument(documentID int, tagID int) error
RemoveTagFromDocument(documentID int, tagID int) error
GetTagUsageCount(tagID int) (int, error)
GetTagGroups() ([]string, error)
GetAllTagAliases() ([]TagAliasEntry, error)
InsertTagAlias(tagID int, aliasName string) error
// Dimension methods
GetAllDimensions() ([]Dimension, error)
GetDimensionByID(id int) (*Dimension, error)
GetDimensionByName(name string) (*Dimension, error)
GetDimensionValues(dimensionID int) ([]DimensionValue, error)
GetDimensionValueByValue(dimensionID int, value string) (*DimensionValue, error)
GetDocumentDimensions(documentID int) (map[string]DimensionValue, error)
SetDocumentDimension(documentID int, dimensionID int, dimensionValueID int) error
RemoveDocumentDimension(documentID int, dimensionID int) error
// Schema version
GetSchemaVersion() (string, error)
// Saved search methods
GetAllSavedSearches() ([]SavedSearch, error)
GetSavedSearchByID(id int) (*SavedSearch, error)
CreateSavedSearch(search *SavedSearch) error
UpdateSavedSearch(search *SavedSearch) error
DeleteSavedSearch(id int) error
// Search execution methods
GetDocumentsByTag(tagID int, page, pageSize int, showHidden ...bool) ([]Document, int, error)
GetUntaggedDocuments(page, pageSize int, showHidden ...bool) ([]Document, int, error)
GetTaggedDocuments(page, pageSize int, showHidden ...bool) ([]Document, int, error)
ExecuteSearch(parsed *ParsedSearch, page, pageSize int, showHidden ...bool) ([]Document, int, error)
// Story methods
CreateStory(story *Story) error
GetStoryByID(id int) (*Story, error)
GetAllStories() ([]Story, error)
GetStoriesWithMeta() ([]StoryWithMeta, error)
UpdateStory(story *Story) error
DeleteStory(id int) error
GetStoryByTagID(tagID int) (*Story, error)
GetStoryTags(storyID int) ([]Tag, error)
AddStoryTag(storyID int, tagID int) error
RemoveStoryTag(storyID int, tagID int) error
AddDocumentToStory(documentID int, storyID int) error
RemoveDocumentFromStory(documentID int, storyID int) error
GetDocumentsWithoutStory(page, pageSize int, showHidden ...bool) ([]Document, int, error)
UpdateDocumentMetadata(ulid string, meta DocumentMetadataUpdate) error
ConvertTagToStory(tagID int) (*Story, error)
ConvertStoryToTag(storyID int) error
}
Repository defines database operations
type SavedSearch ¶ added in v0.34.0
type SavedSearch struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Query string `json:"query"` // Unified search query (text #tag ~exclude)
Icon string `json:"icon"` // Emoji icon
SortOrder int `json:"sort_order"` // Display order
IsSystem bool `json:"is_system"` // True for built-in searches
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SavedSearch represents a saved search query
type SavedSearchWithCount ¶ added in v0.34.0
type SavedSearchWithCount struct {
SavedSearch
DocumentCount int `json:"document_count"`
}
SavedSearchWithCount includes the document count for display
type SearchResult ¶ added in v0.34.0
SearchResult extends Document with search-related info
type Story ¶ added in v0.42.0
type Story struct {
ID int `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
TagID int `json:"tag_id"` // references the story's own tag
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Story represents a grouping of documents (e.g. a house purchase, medical episode). Each story creates a tag with tag_group='Story', so a document belongs to at most one story.
type StoryWithMeta ¶ added in v0.42.0
type StoryWithMeta struct {
Story
Tag Tag // The story's own tag (has color, name etc.)
AssociatedTags []Tag // Tags from story_tags junction
DocumentCount int
StartDateFmt string // Pre-formatted "2006-01-02" for templates (avoids *time.Time filter issues)
EndDateFmt string
}
StoryWithMeta includes the story's tag, associated tags, and document count for display.
type Tag ¶ added in v0.21.4
type Tag struct {
ID int `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
Description string `json:"description,omitempty"`
TagGroup *string `json:"tag_group,omitempty"`
SortOrder int `json:"sort_order"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Tag represents a tag that can be applied to documents If TagGroup is nil/empty, it's a free tag (multiple allowed per document) If TagGroup has a value, only one tag from that group is allowed per document
type TagAliasEntry ¶ added in v0.43.4
TagAliasEntry represents a tag alias with resolved tag name (for config export/import)
type TagWithCount ¶ added in v0.21.4
TagWithCount includes the count of documents using this tag
type WordCloudMetadata ¶
type WordCloudMetadata struct {
LastCalculation time.Time `json:"lastCalculation"`
TotalDocsProcessed int `json:"totalDocsProcessed"`
TotalWordsIndexed int `json:"totalWordsIndexed"`
Version int `json:"version"`
}
WordCloudMetadata tracks word cloud calculation status
type WordFrequency ¶
type WordFrequency struct {
Word string `json:"word"`
Frequency int `json:"frequency"`
Updated time.Time `json:"updated"`
}
WordFrequency represents a word and its frequency count
type WordTokenizer ¶
type WordTokenizer struct {
// contains filtered or unexported fields
}
WordTokenizer handles text processing for word cloud
func NewWordTokenizer ¶
func NewWordTokenizer() *WordTokenizer
NewWordTokenizer creates a new word tokenizer
func (*WordTokenizer) TokenizeAndCount ¶
func (wt *WordTokenizer) TokenizeAndCount(text string) map[string]int
TokenizeAndCount extracts words from text and counts frequencies