Gator in Golang
This is a command-line tool for aggregating and managing RSS feeds, built with Golang. It uses SQLC for database interaction, Goose for migrations, and Postgres as the database.
Features
- Aggregate RSS feeds from various sources
- Stores feeds in a Postgres Database
- Use command-line interface to manage your RSS feeds
Prerequisites
Before running this tool, ensure that the following dependencies are installed:
- Go (version 1.20 or higher)
- PostgreSQL
- Goose (for migrations)
- SQLC (for generating database access layer)
Installing Dependencies
- Go: Download and install Go from the official site or through your package manager.
sudo apt install golang
brew install go
- PostgreSQL: Install Postgres:
sudo apt install postgresql
brew install postgresql
- Goose: Install Goose for database migrations:
go install github.com/pressly/goose/v3/cmd/goose@latest
- SQLC: Install SQLC for code generation:
go install github.com/kyleconroy/sqlc/cmd/sqlc@latest
Set up config file
.gatorconfig.json: Create .gatorconfig.json
file in your machine's home directory. The program will use it to track current user.
{"db_url":"","current_user_name":""}
Installation
Clone the repository and navigate into the project directory:
git clone https://github.com/Xavier-Hsiao/rss-aggregator.git
cd rss-aggregator
Setting Up the Database
- Create a new Postgres database:
createdb rss_aggregator
- Apply database migrations using Goose:
goose postgres "postgres://user:password@localhost/rss_aggregator?sslmode=disable" up
Replace user and password with your PostgreSQL credentials.
- Save the database URL to gatorconfig.json file.
Running the Tool
go build -o rss-cli
./rss-cli
Usage
Use these commands to manage your RSS feeds!
./rss-cli/cmd/rss-aggregator register username
./rss-cli/cmd/rss-aggregator login username
- Add feed for current user
./rss-cli/cmd/rss-aggregator addfeed feedname feedURL
- List out feeds for current user
./rss-cli/cmd/rss-aggregator feeds
./rss-cli/cmd/rss-aggregator follow feedURL
- Aggregate feeds based on provided time
./rss-cli/cmd/rss-aggregator agg 1m
- Browse posts for current users
./rss-cli/cmd/rss-aggregator browse