-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(compose): updated rabbitmq service version into compose * chore(migrations): added migrations to store rss sources * feat(storage): impled storage pkg based on pgsql * chore(tests): added tests for storage pkg * chore(config): updated configs to use new storage module * chore(bins): added new feature to bins and tests * chore(sqlx): prepared sqlx queries to use it offline * fix(fmt): fixed fmt warnings * chore(migrations): added additional table fields * fix(build): fixed features code to build project * fix(tests): fixed test cases after all changes --------- Co-authored-by: Bread White <breadrock1@email.net>
- Loading branch information
1 parent
37d35ca
commit 31849e0
Showing
25 changed files
with
395 additions
and
19 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
.sqlx/query-1da19670bf2c45acb42e3dfbad6c57533be910ea49bd7e7ff5ef936c031cb6b8.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
.sqlx/query-9c7a9b74dbf9019880f6a47398141de5800a169358b353031efcfac3f117509c.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Add down migration script here | ||
|
||
DROP TABLE IF EXISTS rss_sources; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- Add up migration script here | ||
|
||
CREATE TABLE IF NOT EXISTS rss_sources( | ||
id SERIAL PRIMARY KEY, | ||
name TEXT NOT NULL, | ||
link TEXT NOT NULL, | ||
run_at_launch BOOL NOT NULL DEFAULT false, | ||
max_retries INTEGER NOT NULL DEFAULT 3, | ||
timeout INTEGER NOT NULL DEFAULT 100, | ||
interval_secs INTEGER NOT NULL DEFAULT 3600 | ||
); | ||
|
||
INSERT INTO rss_sources(name, link, run_at_launch) | ||
VALUES ('NDTV World News', 'https://feeds.feedburner.com/ndtvnews-world-news', true); | ||
|
||
INSERT INTO rss_sources(name, link, run_at_launch) | ||
VALUES ('Sky World News', 'https://feeds.skynews.com/feeds/rss/world.xml', false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#[cfg(feature = "storage-pgsql")] | ||
use crate::storage::pgsql::config::PgsqlTopicStorageConfig; | ||
|
||
use getset::Getters; | ||
use serde::Deserialize; | ||
|
||
#[derive(Clone, Deserialize, Getters)] | ||
#[getset(get = "pub")] | ||
pub struct StorageConfig { | ||
#[cfg(feature = "storage-pgsql")] | ||
pgsql: PgsqlTopicStorageConfig, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pub mod config; | ||
|
||
#[cfg(feature = "storage-pgsql")] | ||
pub mod pgsql; | ||
|
||
#[async_trait::async_trait] | ||
pub trait LoadTopic { | ||
type Error; | ||
type Topic; | ||
|
||
async fn load_all(&self) -> Result<Vec<Self::Topic>, Self::Error>; | ||
async fn load_at_launch(&self) -> Result<Vec<Self::Topic>, Self::Error>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use getset::{CopyGetters, Getters}; | ||
use serde::Deserialize; | ||
|
||
#[derive(Clone, Deserialize, Getters, CopyGetters)] | ||
#[getset(get = "pub")] | ||
pub struct PgsqlTopicStorageConfig { | ||
address: String, | ||
database: String, | ||
username: String, | ||
password: String, | ||
#[getset(skip)] | ||
#[getset(get_copy = "pub")] | ||
max_pool_size: u32, | ||
} |
Oops, something went wrong.