January 2019
Intermediate to advanced
520 pages
14h 32m
English
The worker needs the following dependencies:
clap = "2.32"config = "0.9"diesel = { version = "^1.1.0", features = ["postgres", "r2d2"] }diesel_migrations = "1.3"env_logger = "0.6"failure = "0.1"log = "0.4"postgres = "0.15"r2d2 = "0.8"serde = "1.0"serde_derive = "1.0"
We need the diesel crate with diesel_migrations to embed all the migrations into the code. It's not necessary, but useful. We need the config and serde crates to configure the worker. The other crates are more common and you can see how we used them in the previous chapters.
Add those dependencies to Cargo.toml and import the types that we will use in the main function:
use diesel::prelude::*;use diesel::connection::Connection;use failure::{format_err, Error};use ...Read now
Unlock full access