Browse Source

Initialize diesel for project

master
dtluna 2 months ago
parent
commit
d3c0fff02a
9 changed files with 60 additions and 16 deletions
  1. +2
    -0
      .gitignore
  2. +33
    -0
      Cargo.lock
  3. +1
    -0
      Cargo.toml
  4. +5
    -0
      diesel.toml
  5. +0
    -0
      migrations/.gitkeep
  6. +1
    -0
      migrations/2020-01-16-182501_create_rss_feed/down.sql
  7. +7
    -0
      migrations/2020-01-16-182501_create_rss_feed/up.sql
  8. +2
    -16
      src/main.rs
  9. +9
    -0
      src/schema.rs

+ 2
- 0
.gitignore View File

@@ -1,2 +1,4 @@
/target
**/*.rs.bk
.env
*.sqlite3

+ 33
- 0
Cargo.lock View File

@@ -172,6 +172,26 @@ dependencies = [
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "diesel"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel_derives 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libsqlite3-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "diesel_derives"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "encoding_rs"
version = "0.8.20"
@@ -204,6 +224,7 @@ dependencies = [
name = "feedman"
version = "0.1.0"
dependencies = [
"diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"isahc 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rss 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -332,6 +353,15 @@ dependencies = [
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "libsqlite3-sys"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "libz-sys"
version = "1.0.25"
@@ -635,6 +665,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum derive_builder 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ac53fa6a3cda160df823a9346442525dcaf1e171999a1cf23e67067e4fd64d4"
"checksum derive_builder_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0288a23da9333c246bb18c143426074a6ae96747995c5819d2947b64cd942b37"
"checksum derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6d944ac6003ed268757ef1ee686753b57efc5fcf0ebe7b64c9fc81e7e32ff839"
"checksum diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d7cc03b910de9935007861dce440881f69102aaaedfd4bc5a6f40340ca5840c"
"checksum diesel_derives 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
"checksum encoding_rs 0.8.20 (registry+https://github.com/rust-lang/crates.io-index)" = "87240518927716f79692c2ed85bfe6e98196d18c6401ec75355760233a7e12e9"
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
@@ -653,6 +685,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
"checksum libnghttp2-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02254d44f4435dd79e695f2c2b83cd06a47919adea30216ceaf0c57ca0a72463"
"checksum libsqlite3-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5b95e89c330291768dc840238db7f9e204fd208511ab6319b56193a7f2ae25"
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"


+ 1
- 0
Cargo.toml View File

@@ -10,3 +10,4 @@ edition = "2018"
http = "0.1.19"
isahc = "0.8.1"
rss = "1.8.0"
diesel = { version = "1.0.0", features = ["sqlite"] }

+ 5
- 0
diesel.toml View File

@@ -0,0 +1,5 @@
# For documentation on how to configure this file,
# see diesel.rs/guides/configuring-diesel-cli

[print_schema]
file = "src/schema.rs"

+ 0
- 0
migrations/.gitkeep View File


+ 1
- 0
migrations/2020-01-16-182501_create_rss_feed/down.sql View File

@@ -0,0 +1 @@
DROP TABLE rss_feed

+ 7
- 0
migrations/2020-01-16-182501_create_rss_feed/up.sql View File

@@ -0,0 +1,7 @@
CREATE TABLE rss_feed (
id INTEGER PRIMARY KEY NOT NULL,
rss_url VARCHAR(1024) NOT NULL,
url VARCHAR(1024) NOT NULL,
title VARCHAR(1024) NOT NULL,
last_modified INTEGER NOT NULL DEFAULT 0
)

+ 2
- 16
src/main.rs View File

@@ -1,17 +1,3 @@
use http::StatusCode;
use isahc::prelude::*;
use rss::Channel;
use std::error::Error;
use std::str::FromStr;

fn main() -> Result<(), Box<dyn Error>> {
let mut response = isahc::get("https://nonserviam.media/podcasts/index.xml")?;
match response.status() {
StatusCode::OK => (),
x => panic!("{}", x),
}
let resp_text = response.text()?;
let channel = Channel::from_str(&resp_text)?;
println!("{}", channel.title());
Ok(())
fn main() {
println!("Hello world!");
}

+ 9
- 0
src/schema.rs View File

@@ -0,0 +1,9 @@
table! {
rss_feed (id) {
id -> Integer,
rss_url -> Text,
url -> Text,
title -> Text,
last_modified -> Integer,
}
}

Loading…
Cancel
Save