rssreader package - github.com/RssReaderProject/RssReader - Go Packages

rssreader

package module
v0.0.0-...-9255069 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 6 Imported by: 0

README

RSS Reader Package

A Go package for parsing RSS feeds asynchronously from multiple URLs.

Overview

This package provides functionality to parse RSS feeds from multiple URLs concurrently and return structured data. It uses the latest stable version of Go and follows Go best practices.

Features

  • Asynchronous RSS feed parsing from multiple URLs
  • Structured RSS item data with all essential fields
  • Comprehensive test coverage

API

Types
type RssItem struct {
    Title        string
    Source       string
    SourceURL    string
    Link         string
    PublishDate  time.Time
    Description  string
}
Methods
func Parse(ctx context.Context, urls []string) ([]RssItem, error)
  • Parameters: ctx - context for cancellation and timeout; urls - Array of RSS feed URLs to parse
  • Returns: Array of RssItem structs generated from all provided RSS posts
  • Behavior: Parses feeds asynchronously for better performance

Requirements

Installation

go get github.com/yourusername/RssReader

Usage

package main

import (
    "context"
    "fmt"
    "log"
    "time"
    
    "github.com/yourusername/RssReader"
)

func main() {
    ctx := context.Background()
    urls := []string{
        "https://example.com/feed.xml",
        "https://another-blog.com/rss",
    }
    
    items, err := RssReader.Parse(ctx, urls)
    if err != nil {
        log.Fatal(err)
    }
    
    for _, item := range items {
        fmt.Printf("Title: %s\n", item.Title)
        fmt.Printf("Source: %s\n", item.Source)
        fmt.Printf("Published: %s\n", item.PublishDate.Format(time.RFC3339))
        fmt.Printf("Link: %s\n", item.Link)
        fmt.Printf("---\n")
    }
}

Development

Prerequisites
  • Go 1.24+
Running Tests
go test ./...
Running Linter
golangci-lint run
Running Security Checks
gosec ./...
All Checks
make all

Project Structure

RssReader/
├── README.md
├── go.mod
├── go.sum
├── .github/
│   └── workflows/
│       └── ci.yml
├── .golangci.yml
└── rssreader.go

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

MIT

Testing

All changes must be covered with tests. The project includes:

  • Unit tests for all exported functions
  • Integration tests for RSS parsing
  • Benchmark tests for performance validation

Run the full test suite with:

go test -v -race -cover ./...

Documentation

Overview

Package rssreader provides functionality for parsing RSS feeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RssItem

type RssItem struct {
	Title       string
	Source      string
	SourceURL   string
	Link        string
	PublishDate time.Time
	Description string
	RssURL      string
}

RssItem represents a single item from an RSS feed.

func Parse

func Parse(ctx context.Context, urls []string) ([]RssItem, error)

Parse fetches and parses RSS feeds from the provided URLs asynchronously. It returns a slice of RssItem and any error encountered during parsing.

Directories

Path Synopsis
cmd
rssreader command
Main entry point for the RSS reader CLI tool.
Main entry point for the RSS reader CLI tool.

Jump to

Keyboard shortcuts

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