1
0
mirror of https://github.com/actix/examples synced 2025-06-28 09:50:36 +02:00

migrate http proxy examples

This commit is contained in:
Nikolay Kim
2019-03-26 23:33:13 -07:00
parent 53fc2221ef
commit 48b8e7c335
9 changed files with 125 additions and 177 deletions

View File

@ -15,7 +15,8 @@ failure = "0.1.1"
futures = "0.1"
num_cpus = "1.10.0"
r2d2 = "0.8.2"
r2d2_sqlite = "0.5.0"
r2d2_sqlite = "0.8.0"
rusqlite = "0.16"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"

View File

@ -3,6 +3,7 @@ use failure::Error;
use futures::Future;
use r2d2;
use r2d2_sqlite;
use rusqlite::NO_PARAMS;
use serde_derive::{Deserialize, Serialize};
use std::{thread::sleep, time::Duration};
@ -47,7 +48,7 @@ fn get_hottest_years(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
let mut prep_stmt = conn.prepare(stmt)?;
let annuals = prep_stmt
.query_map(&[], |row| WeatherAgg::AnnualAgg {
.query_map(NO_PARAMS, |row| WeatherAgg::AnnualAgg {
year: row.get(0),
total: row.get(1),
})
@ -73,7 +74,7 @@ fn get_coldest_years(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
let mut prep_stmt = conn.prepare(stmt)?;
let annuals = prep_stmt
.query_map(&[], |row| WeatherAgg::AnnualAgg {
.query_map(NO_PARAMS, |row| WeatherAgg::AnnualAgg {
year: row.get(0),
total: row.get(1),
})
@ -99,7 +100,7 @@ fn get_hottest_months(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
let mut prep_stmt = conn.prepare(stmt)?;
let annuals = prep_stmt
.query_map(&[], |row| WeatherAgg::MonthAgg {
.query_map(NO_PARAMS, |row| WeatherAgg::MonthAgg {
year: row.get(0),
month: row.get(1),
total: row.get(2),
@ -125,7 +126,7 @@ fn get_coldest_months(conn: Connection) -> Result<Vec<WeatherAgg>, Error> {
let mut prep_stmt = conn.prepare(stmt)?;
let annuals = prep_stmt
.query_map(&[], |row| WeatherAgg::MonthAgg {
.query_map(NO_PARAMS, |row| WeatherAgg::MonthAgg {
year: row.get(0),
month: row.get(1),
total: row.get(2),