Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortArticles ¶ added in v0.3.0
SortArticles sorts a slice of articles based on the provided sort fields. Each sort field can be in the format "FieldName" or "FieldName:direction" where direction is either "asc" or "desc".
Types ¶
type Article ¶
type Article struct {
// Title of the article
Title string
// Author of the article, if available
Author string
// PublishedAt is the publication date of the article
PublishedAt time.Time
// URL is the original source URL of the article
URL string
// Content is the full text content of the article
Content string
// Summary is a short summary or description of the article
Summary string
// SourceName identifies which source this article came from
SourceName string
// Tags are optional categorization tags for the article
Tags []string
// Metadata contains any additional source-specific metadata
Metadata map[string]any
}
Article represents a single piece of content from a source.
func DeduplicateArticlesByURL ¶ added in v0.3.0
DeduplicateArticlesByURL removes duplicate articles with the same URL. Returns a new slice containing only unique articles, keeping the first occurrence of each URL.
type Digest ¶
type Digest struct {
// Title of the digest
Title string
// GeneratedAt is when this digest was created
GeneratedAt time.Time
// Articles is the collection of articles in this digest
Articles []*Article
// Metadata contains any additional digest-specific metadata
Metadata map[string]interface{}
}
Digest represents a collection of articles ready for formatting.
type SortField ¶ added in v0.3.0
type SortField struct {
// Name is the name of the field to sort by
Name string
// Direction is either "asc" or "desc"
Direction string
}
SortField represents a field to sort articles by, along with its direction.
func ParseSortField ¶ added in v0.3.0
ParseSortField parses a sort field string in the format "FieldName:direction". If no direction is specified, defaults to "asc". Returns a SortField struct.