├── rust-toolchain ├── .gitignore ├── Cargo.toml ├── sprattus-derive ├── src │ ├── from_sql.rs │ ├── to_sql.rs │ ├── lib.rs │ └── functions.rs └── Cargo.toml ├── docker-compose.yml ├── .travis.yml ├── sprattus-test ├── Cargo.toml └── src │ ├── keywords.rs │ └── main.rs ├── sprattus ├── Cargo.toml └── src │ ├── traits.rs │ ├── lib.rs │ └── connection.rs ├── README.MD ├── LICENSE └── Cargo.lock /rust-toolchain: -------------------------------------------------------------------------------- 1 | beta -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | target 3 | .env -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "sprattus", 4 | "sprattus-test", 5 | "sprattus-derive", 6 | ] 7 | -------------------------------------------------------------------------------- /sprattus-derive/src/from_sql.rs: -------------------------------------------------------------------------------- 1 | use proc_macro2::{Ident, Literal}; 2 | 3 | #[derive(Debug)] 4 | pub(crate) struct SqlField { 5 | pub rust_name: Ident, 6 | pub sql_name: Literal, 7 | } 8 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.3' 2 | services: 3 | psql: 4 | image: postgres:10 5 | environment: 6 | POSTGRES_USER: tg 7 | volumes: 8 | - "./shared/*:/docker-entrypoint-initdb.d/" 9 | working_dir: /app 10 | ports: ["5432:5432"] 11 | networks: [default] 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | rust: 3 | - stable 4 | env: 5 | - DOCKER_COMPOSE_VERSION=1.4.2 6 | 7 | jobs: 8 | fast_finish: true 9 | 10 | script: 11 | - cargo build --verbose --all 12 | - cargo test --verbose --all 13 | - cd ./sprattus-test && cargo run 14 | 15 | services: 16 | - postgresql -------------------------------------------------------------------------------- /sprattus-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sprattus-test" 3 | version = "0.1.0" 4 | authors = ["Martijn Groeneveldt "] 5 | edition = "2018" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | sprattus = { path = "../sprattus", features = ["with-chrono-0_4"] } 11 | tokio = { version = "0.2", features = ["macros"] } 12 | chrono = "^0.4.0" 13 | -------------------------------------------------------------------------------- /sprattus-derive/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sprattus-derive" 3 | version = "0.0.1" 4 | authors = ["Martijn "] 5 | edition = "2018" 6 | readme = "../README.MD" 7 | license-file = "../LICENSE" 8 | description = "The derive macros for a async orm for Postgres" 9 | repository = "https://github.com/dutchmartin/sprattus" 10 | categories = ["database", "asynchronous", "postgres"] 11 | 12 | [lib] 13 | proc-macro = true 14 | 15 | [dependencies] 16 | syn = { version = "1.0.5", features = ["extra-traits"]} 17 | quote = { version = "1.0.2" } 18 | proc-macro2 = "1.0.2" -------------------------------------------------------------------------------- /sprattus/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sprattus" 3 | version = "0.0.1" 4 | authors = ["Martijn Groeneveldt "] 5 | edition = "2018" 6 | readme = "../README.MD" 7 | description = "A async orm for Postgres" 8 | repository = "https://github.com/dutchmartin/sprattus" 9 | license-file = "../LICENSE" 10 | categories = ["database", "asynchronous", "postgres"] 11 | 12 | 13 | [dependencies] 14 | tokio-postgres = { version="=0.5.1" , features = ["default"]} 15 | futures-util = "0.3.1" 16 | strfmt = "0.1.6" 17 | sprattus-derive = "0.0.1" 18 | tokio = "0.2" 19 | 20 | 21 | [features] 22 | "with-bit-vec-0_6" = ["tokio-postgres/with-bit-vec-0_6"] 23 | "with-chrono-0_4" = ["tokio-postgres/with-chrono-0_4"] 24 | "with-eui48-0_4" = ["tokio-postgres/with-eui48-0_4"] 25 | "with-geo-types-0_4" = ["tokio-postgres/with-geo-types-0_4"] 26 | "with-serde_json-1" = ["tokio-postgres/with-serde_json-1"] 27 | "with-uuid-0_8" = ["tokio-postgres/with-uuid-0_8"] -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | Sprattus, a async Rust ORM for Postgres 2 | ================ 3 | [![Build Status](https://api.travis-ci.com/dutchmartin/sprattus.svg?branch=master)](https://travis-ci.com/dutchmartin/sprattus) 4 | [![Documentation](https://docs.rs/sprattus/badge.svg)](https://docs.rs/sprattus/) 5 | 6 | Sprattus is a crate that let's you easily do async CRUD operations on your Postgres database with Rust structs. 7 | 8 | ## Getting started 9 | 10 | Add sprattus to your cargo.toml: 11 | ```toml 12 | sprattus = "0.0.1" 13 | ``` 14 | Create a table in Postgres: 15 | ```sql 16 | CREATE TABLE fruits( 17 | id SERIAL PRIMARY KEY, 18 | name VARCHAR NOT NULL 19 | ); 20 | ``` 21 | 22 | Create a struct corresponding to the created table: 23 | ```rust 24 | struct Fruit { 25 | id: i32, 26 | name: String 27 | } 28 | ``` 29 | And finally add the sprattus macro's and annotations: 30 | ```rust 31 | use sprattus::*; 32 | 33 | #[derive(ToSql, FromSql, Debug)] 34 | #[sql(table = "fruits")] 35 | struct Fruit { 36 | #[sql(primary_key)] 37 | id: i32, 38 | name: String 39 | } 40 | ``` 41 | And now you're ready to use the client in combination with you freshly created struct! 42 | 43 | ```rust 44 | use tokio::prelude::*; 45 | use sprattus::*; 46 | 47 | #[derive(ToSql, FromSql)] 48 | #[sql(table = "fruits")] 49 | struct Fruit { 50 | #[sql(primary_key)] 51 | id: i32, 52 | name: String 53 | } 54 | 55 | #[tokio::main] 56 | async fn main() -> Result<(), Error>{ 57 | let conn = PGConnection::new("postgresql://localhost?user=postgres").await?; 58 | let fruit = Fruit { 59 | id: 0, 60 | name: String::from("apple") 61 | }; 62 | let created_fruit = conn.create(fruit).await?; 63 | dbg!(created_fruit); 64 | Ok(()) 65 | } 66 | ``` 67 | 68 | Please check out the [docs](https://docs.rs/sprattus) for further reference. 69 | 70 | ## name 71 | The name sprattus is the genus of the fish named [sprat](https://en.wikipedia.org/wiki/Sprat). It is a fitting name because of the schooling behavour of the sprat: 72 | > Sprats travel asynchronous from each other in large schools with other fish and swim continuously throughout the day 73 | 74 | -------------------------------------------------------------------------------- /sprattus/src/traits.rs: -------------------------------------------------------------------------------- 1 | use tokio_postgres::types::ToSql as ToSqlItem; 2 | use tokio_postgres::{Error, Row}; 3 | 4 | /// Arranges deserialization from Postgres table values to a Rust struct. 5 | pub trait FromSql { 6 | /// 7 | /// Implementors of this method create an instance of Self with the content of a Row. 8 | /// 9 | fn from_row(row: &Row) -> Result 10 | where 11 | Self: Sized; 12 | } 13 | 14 | /// All required methods to create, update and delete the struct it's implemented for. 15 | pub trait ToSql { 16 | /// 17 | /// Returns the name of the table. 18 | /// 19 | fn get_table_name() -> &'static str; 20 | /// 21 | /// Returns the Postgres name of the primary key. 22 | /// 23 | fn get_primary_key() -> &'static str; 24 | 25 | /// Represents the Rust type of the primary key. 26 | type PK; 27 | 28 | /// Returns the value of the primary key. 29 | fn get_primary_key_value(&self) -> Self::PK 30 | where 31 | Self::PK: ToSqlItem + Sized + Sync; 32 | 33 | /// 34 | /// The fields that contain the data of the table. 35 | /// The primary key is excluded from this list. 36 | /// 37 | fn get_fields() -> &'static str; 38 | 39 | /// Returns a comma separated list with the Postgres names of all fields. 40 | fn get_all_fields() -> &'static str; 41 | 42 | /// Returns a vector of references to all values of the implemented struct. 43 | fn get_values_of_all_fields(&self) -> Vec<&(dyn ToSqlItem + Sync)>; 44 | 45 | /// 46 | /// The method that implements converting the fields 47 | /// into a array of items that implement the ToSql trait of rust_postgres. 48 | /// 49 | fn get_query_params(&self) -> Vec<&(dyn ToSqlItem + Sync)>; 50 | 51 | /// 52 | /// Returns the formatted prepared statement list. 53 | /// 54 | /// Example return value: `$1, $2` 55 | /// 56 | fn get_prepared_arguments_list() -> &'static str; 57 | 58 | /// 59 | /// Returns the formatted prepared statement list with Postgres types. 60 | /// 61 | /// Example return value: `$1::INT, $2::VARCHAR` 62 | /// 63 | fn get_prepared_arguments_list_with_types() -> &'static str; 64 | 65 | /// Returns the amount of fields excluding the primary key. 66 | fn get_argument_count() -> usize; 67 | } 68 | -------------------------------------------------------------------------------- /sprattus-test/src/keywords.rs: -------------------------------------------------------------------------------- 1 | use sprattus::*; 2 | 3 | /// This struct just contains keywords as names, just to test. 4 | #[derive(Eq, PartialEq, Debug, ToSql, FromSql)] 5 | struct Collate { 6 | #[sql(primary_key)] 7 | id: i32, 8 | column: bool, 9 | desc: bool, 10 | constraint: Option, 11 | current_user: String, 12 | fetch: String, 13 | } 14 | 15 | pub async fn test_if_keywords_are_escaped(conn: Connection) -> Result<(), Error> { 16 | print!("\n Testing if keywords are properly escaped ... \n\n"); 17 | 18 | let fixture = vec![ 19 | Collate { 20 | id: 1, 21 | column: true, 22 | desc: false, 23 | constraint: Some(103), 24 | current_user: String::from("Martin"), 25 | fetch: String::from("example.com"), 26 | }, 27 | Collate { 28 | id: 2, 29 | column: true, 30 | desc: true, 31 | constraint: Some(7689), 32 | current_user: String::from("Steven"), 33 | fetch: String::from("google.com"), 34 | }, 35 | Collate { 36 | id: 3, 37 | column: false, 38 | desc: true, 39 | constraint: Some(543_432), 40 | current_user: String::from("Superman"), 41 | fetch: String::from("tweedegolf.nl"), 42 | }, 43 | ]; 44 | 45 | let update_fixture = vec![ 46 | Collate { 47 | id: 1, 48 | column: false, 49 | desc: false, 50 | constraint: Some(4535), 51 | current_user: String::from("Martin"), 52 | fetch: String::from("martijngroeneveldt.nl"), 53 | }, 54 | Collate { 55 | id: 2, 56 | column: false, 57 | desc: true, 58 | constraint: Some(7_645_389), 59 | current_user: String::from("Steven"), 60 | fetch: String::from("google.com"), 61 | }, 62 | Collate { 63 | id: 3, 64 | column: false, 65 | desc: false, 66 | constraint: None, 67 | current_user: String::from("Batman"), 68 | fetch: String::from("tweedegolf.nl"), 69 | }, 70 | ]; 71 | // Setup table 72 | conn.batch_execute( 73 | "DROP TABLE IF EXISTS \"Collate\"; 74 | CREATE TABLE \"Collate\" ( 75 | \"id\" serial NOT NULL, 76 | \"column\" bool NOT NULL, 77 | \"desc\" bool NOT NULL, 78 | \"constraint\" int4 NULL, 79 | \"current_user\" varchar NOT NULL, 80 | \"fetch\" varchar NOT NULL);", 81 | ) 82 | .await?; 83 | 84 | // Insert test 85 | let created_items = conn.create_multiple(&fixture).await?; 86 | assert_eq!(created_items, fixture); 87 | println!("Insert succeeded"); 88 | 89 | // Query test 90 | let queried_reorders = conn 91 | .query_multiple::("SELECT * FROM \"Collate\" WHERE id IN (1,2,3,4,5)", &[]) 92 | .await?; 93 | assert_eq!(queried_reorders, fixture); 94 | println!("Query succeeded"); 95 | 96 | // Update test 97 | let updated_items = conn.update_multiple(&update_fixture).await?; 98 | assert_eq!(updated_items, update_fixture); 99 | println!("Update succeeded"); 100 | 101 | // Delete test 102 | let deleted_items = conn.delete_multiple(&update_fixture).await?; 103 | assert_eq!(deleted_items, update_fixture); 104 | println!("Delete succeeded"); 105 | 106 | Ok(()) 107 | } 108 | -------------------------------------------------------------------------------- /sprattus-derive/src/to_sql.rs: -------------------------------------------------------------------------------- 1 | extern crate proc_macro; 2 | 3 | use crate::functions::*; 4 | use proc_macro2::{Ident, Literal, TokenStream}; 5 | use quote::quote; 6 | 7 | #[derive(Debug, Eq, PartialEq)] 8 | pub(crate) enum KeyType { 9 | PrimaryKey, 10 | PrimaryKeyCandidate, 11 | NoKey, 12 | } 13 | 14 | pub(crate) enum StructName { 15 | Renamed { original: Ident, new: Literal }, 16 | Named { name: Ident }, 17 | } 18 | pub(crate) struct StructFieldData { 19 | pub name: StructName, 20 | pub key_type: KeyType, 21 | pub field_type: Ident, 22 | pub pg_field_type: String, 23 | } 24 | 25 | impl quote::ToTokens for StructName { 26 | fn to_tokens(&self, tokens: &mut TokenStream) { 27 | match &self { 28 | StructName::Renamed { original, .. } => { 29 | let n = original.clone(); 30 | tokens.extend(quote!(#n)); 31 | } 32 | StructName::Named { name } => { 33 | let n = name.clone(); 34 | tokens.extend(quote!(#n)); 35 | } 36 | } 37 | } 38 | } 39 | 40 | impl ToString for StructName { 41 | fn to_string(&self) -> String { 42 | match self { 43 | StructName::Renamed { new, .. } => new.to_string(), 44 | StructName::Named { name } => name.to_string(), 45 | } 46 | } 47 | } 48 | 49 | pub(crate) fn build_to_sql_implementation( 50 | name: &Ident, 51 | table_name: String, 52 | field_list: &mut Vec, 53 | ) -> proc_macro::TokenStream { 54 | let (primary_key, primary_key_type) = field_list 55 | .iter() 56 | .filter(|field| field.key_type == KeyType::PrimaryKey) 57 | .map(|field| (&field.name, &field.field_type)) 58 | .next() 59 | .unwrap_or_else(|| { 60 | panic!("no field field with the 'primary_key' attribute found"); 61 | }); 62 | let primary_key_string = primary_key.to_string(); 63 | let arguments_list_with_types = generate_argument_list_with_types(&field_list); 64 | 65 | let non_pk_field_list: Vec<&StructName> = field_list 66 | .iter() 67 | .filter(|field| field.key_type != KeyType::PrimaryKey) 68 | .map(|field| &field.name) 69 | .collect(); 70 | 71 | let field_list_string = generate_field_list( 72 | non_pk_field_list 73 | .iter() 74 | .map(|item| item.to_string()) 75 | .collect::>() 76 | .as_slice(), 77 | ); 78 | 79 | let all_fields_list_string = generate_field_list( 80 | field_list 81 | .iter() 82 | .map(|field| field.name.to_string()) 83 | .collect::>() 84 | .as_slice(), 85 | ); 86 | let field_list_len = non_pk_field_list.len(); 87 | let prepared_arguments_list = generate_argument_list(field_list_len); 88 | 89 | let tokens = quote!( 90 | impl ToSql for #name { 91 | 92 | #[inline] 93 | fn get_table_name() -> &'static str { 94 | stringify!(#table_name) 95 | } 96 | 97 | #[inline] 98 | fn get_primary_key() -> &'static str { 99 | #primary_key_string 100 | } 101 | 102 | type PK = #primary_key_type; 103 | 104 | #[inline] 105 | fn get_primary_key_value(&self) -> Self::PK 106 | where 107 | Self::PK: ToSqlItem + Sized + Sync 108 | { 109 | self.#primary_key 110 | } 111 | 112 | #[inline] 113 | fn get_all_fields() -> &'static str { 114 | #all_fields_list_string 115 | } 116 | 117 | #[inline] 118 | fn get_fields() -> &'static str { 119 | #field_list_string 120 | } 121 | 122 | #[inline] 123 | fn get_values_of_all_fields(&self) -> Vec<&(dyn ToSqlItem + Sync)> { 124 | vec![&self.#primary_key,#(&self.#non_pk_field_list),*] 125 | } 126 | 127 | #[inline] 128 | fn get_query_params(&self) -> Vec<&(dyn ToSqlItem + Sync)> { 129 | vec![#(&self.#non_pk_field_list),*] 130 | } 131 | 132 | #[inline] 133 | fn get_prepared_arguments_list() -> &'static str { 134 | #prepared_arguments_list 135 | } 136 | 137 | #[inline] 138 | fn get_prepared_arguments_list_with_types() -> &'static str { 139 | #arguments_list_with_types 140 | } 141 | 142 | #[inline] 143 | fn get_argument_count() -> usize { 144 | #field_list_len 145 | } 146 | } 147 | ); 148 | tokens.into() 149 | } 150 | -------------------------------------------------------------------------------- /sprattus-test/src/main.rs: -------------------------------------------------------------------------------- 1 | use crate::keywords::test_if_keywords_are_escaped; 2 | use chrono::*; 3 | use sprattus::*; 4 | 5 | mod keywords; 6 | 7 | #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] 8 | #[sql(table = "reorder")] 9 | struct Reorder { 10 | #[sql(primary_key)] 11 | #[sql(name = "prod_id")] 12 | id: i32, 13 | date_low: NaiveDate, 14 | #[sql(name = "quan_low")] 15 | quantity_low: i32, 16 | date_reordered: Option, 17 | #[sql(name = "quan_reordered")] 18 | quantity_reordered: Option, 19 | date_expected: Option, 20 | } 21 | 22 | #[tokio::main] 23 | async fn main() -> Result<(), Error> { 24 | println!(" Starting Tests...\n"); 25 | let conn = Connection::new("postgresql://localhost?user=postgres") 26 | .await 27 | .unwrap(); 28 | 29 | conn.batch_execute( 30 | "DROP TABLE IF EXISTS reorder; 31 | CREATE TABLE reorder ( 32 | prod_id serial NOT NULL, 33 | date_low date NOT NULL, 34 | quan_low int4 NOT NULL, 35 | date_reordered date NULL, 36 | quan_reordered int4 NULL, 37 | date_expected date NULL);", 38 | ) 39 | .await?; 40 | 41 | let reorders = vec![ 42 | Reorder { 43 | id: 1, 44 | date_low: NaiveDate::from_ymd(1944, 11, 6), 45 | quantity_low: 0, 46 | date_reordered: None, 47 | quantity_reordered: Some(10001), 48 | date_expected: None, 49 | }, 50 | Reorder { 51 | id: 2, 52 | date_low: NaiveDate::from_ymd(1945, 5, 5), 53 | quantity_low: 0, 54 | date_reordered: None, 55 | quantity_reordered: Some(1), 56 | date_expected: None, 57 | }, 58 | Reorder { 59 | id: 3, 60 | date_low: NaiveDate::from_ymd(1969, 11, 6), 61 | quantity_low: 0, 62 | date_reordered: None, 63 | quantity_reordered: Some(300), 64 | date_expected: None, 65 | }, 66 | Reorder { 67 | id: 4, 68 | date_low: NaiveDate::from_ymd(1989, 11, 6), 69 | quantity_low: 0, 70 | date_reordered: None, 71 | quantity_reordered: Some(4), 72 | date_expected: None, 73 | }, 74 | Reorder { 75 | id: 5, 76 | date_low: NaiveDate::from_ymd(1998, 11, 26), 77 | quantity_low: 0, 78 | date_reordered: None, 79 | quantity_reordered: Some(5), 80 | date_expected: None, 81 | }, 82 | ]; 83 | let reorders_update = vec![ 84 | Reorder { 85 | id: 1, 86 | date_low: NaiveDate::from_ymd(1944, 11, 6), 87 | quantity_low: 0, 88 | date_reordered: None, 89 | quantity_reordered: Some(20002), 90 | date_expected: Some(NaiveDate::from_ymd(1944, 11, 7)), 91 | }, 92 | Reorder { 93 | id: 2, 94 | date_low: NaiveDate::from_ymd(1945, 5, 5), 95 | quantity_low: 0, 96 | date_reordered: None, 97 | quantity_reordered: None, 98 | date_expected: None, 99 | }, 100 | Reorder { 101 | id: 3, 102 | date_low: NaiveDate::from_ymd(1969, 11, 6), 103 | quantity_low: 0, 104 | date_reordered: None, 105 | quantity_reordered: Some(300), 106 | date_expected: None, 107 | }, 108 | Reorder { 109 | id: 4, 110 | date_low: NaiveDate::from_ymd(1989, 11, 6), 111 | quantity_low: 0, 112 | date_reordered: None, 113 | quantity_reordered: Some(4), 114 | date_expected: None, 115 | }, 116 | Reorder { 117 | id: 5, 118 | date_low: NaiveDate::from_ymd(1998, 11, 26), 119 | quantity_low: 0, 120 | date_reordered: None, 121 | quantity_reordered: Some(3), 122 | date_expected: Some(NaiveDate::from_ymd(1998, 12, 26)), 123 | }, 124 | ]; 125 | 126 | // Insert test 127 | let created_reorders = conn.create_multiple(&reorders).await?; 128 | assert_eq!(created_reorders, reorders); 129 | println!("Insert succeeded"); 130 | 131 | // Query test 132 | let queried_reorders = conn 133 | .query_multiple::("SELECT * FROM reorder WHERE prod_id IN (1,2,3,4,5)", &[]) 134 | .await?; 135 | assert_eq!(queried_reorders, reorders); 136 | println!("Query succeeded"); 137 | 138 | // Update test 139 | let updated_reorders = conn.update_multiple(&reorders_update).await?; 140 | assert_eq!(updated_reorders, reorders_update); 141 | println!("Update succeeded"); 142 | 143 | // Delete test 144 | let deleted_reorders = conn.delete_multiple(&reorders_update).await?; 145 | assert_eq!(deleted_reorders, reorders_update); 146 | println!("Delete succeeded"); 147 | 148 | test_if_keywords_are_escaped(conn).await?; 149 | 150 | print!("\n Done!\n"); 151 | Ok(()) 152 | } 153 | -------------------------------------------------------------------------------- /sprattus-derive/src/lib.rs: -------------------------------------------------------------------------------- 1 | extern crate proc_macro; 2 | 3 | mod from_sql; 4 | mod functions; 5 | mod to_sql; 6 | 7 | use crate::from_sql::SqlField; 8 | use crate::functions::*; 9 | use crate::to_sql::*; 10 | use proc_macro2::{Literal, TokenTree::Group}; 11 | use quote::quote; 12 | use syn::export::TokenStream2; 13 | use syn::{parse_macro_input, Data::Struct, DeriveInput}; 14 | 15 | /// Automatically implements the [`ToSql`](./trait.ToSql.html) trait for a given struct. 16 | #[proc_macro_derive(ToSql, attributes(sql))] 17 | pub fn to_sql(input: proc_macro::TokenStream) -> proc_macro::TokenStream { 18 | let derive_input = parse_macro_input!(input as DeriveInput); 19 | 20 | let name = &derive_input.ident; 21 | 22 | // Set table name to to either the defined attribute value, or fall back on the structs name 23 | let table_name: String = match get_table_name_from_attributes(derive_input.attrs) { 24 | Some(table_name) => table_name, 25 | None => name.to_string(), 26 | }; 27 | let mut fields_info: Vec = Vec::new(); 28 | 29 | match derive_input.data { 30 | Struct(data) => { 31 | for field in data.fields.clone() { 32 | let field_name = get_field_name(&field); 33 | let field_name = match find_field_table_name(&field) { 34 | Some(name) => StructName::Renamed { 35 | original: (field_name), 36 | new: (name), 37 | }, 38 | None => StructName::Named { name: (field_name) }, 39 | }; 40 | let key_type = find_key_type(&field); 41 | let field_type = get_ident_name_from_path(&field.ty); 42 | let pg_field_type = get_postgres_datatype(field_type.to_string()); 43 | 44 | fields_info.push(StructFieldData { 45 | name: (field_name), 46 | key_type, 47 | field_type, 48 | pg_field_type, 49 | }) 50 | } 51 | } 52 | _ => panic!(format!( 53 | "Deriving on {}, which is not a struct, is not supported", 54 | name.to_string() 55 | )), 56 | }; 57 | build_to_sql_implementation(&name, table_name, &mut fields_info) 58 | } 59 | 60 | /// Automatically implements the [`FromSql`](./trait.FromSql.html) trait for a given struct. 61 | #[proc_macro_derive(FromSql, attributes(sql))] 62 | pub fn from_sql(input: proc_macro::TokenStream) -> proc_macro::TokenStream { 63 | let input = parse_macro_input!(input as DeriveInput); 64 | 65 | // Gather data. 66 | let name = &input.ident; 67 | let mut fields: Vec = Vec::new(); 68 | 69 | if let Struct(data) = input.data { 70 | 'field_loop: for field in data.fields { 71 | 'attribute_loop: for attr in field.attrs { 72 | if let Some(ident) = attr.path.segments.first() { 73 | if ident.ident.eq("sql") { 74 | // Attr is ours, let's parse it. 75 | for tokens in attr.tokens.into_iter() { 76 | let group = match tokens { 77 | Group(group) => group, 78 | _ => panic!("cannot find a group of tokens to parse"), 79 | }; 80 | let (key, value) = get_key_value_of_attribute(group); 81 | match &field.ident { 82 | Some(ident) => { 83 | // Validate if the rename attribute is used. 84 | if key.eq("name") { 85 | let sql_name = match value { 86 | None => Literal::string(ident.to_string().as_str()), 87 | Some(sql_value) => sql_value, 88 | }; 89 | fields.push(SqlField { 90 | rust_name: ident.clone(), 91 | sql_name, 92 | }); 93 | continue 'field_loop; 94 | } else { 95 | continue 'attribute_loop; 96 | } 97 | } 98 | _ => panic!("Cannot implement FromSql on a tuple struct"), 99 | } 100 | } 101 | } else { 102 | continue 'attribute_loop; 103 | } 104 | } 105 | } 106 | if let Some(ident) = &field.ident { 107 | let name = &ident.to_string(); 108 | fields.push(SqlField { 109 | rust_name: ident.clone(), 110 | sql_name: Literal::string(name.as_str()), 111 | }); 112 | continue 'field_loop; 113 | } 114 | } 115 | } else { 116 | panic!(format!( 117 | "Deriving on {}, which is not a struct, is not supported", 118 | name.to_string() 119 | )) 120 | } 121 | 122 | // Build the lines for constructing the struct. 123 | let mut struct_lines: Vec = Vec::new(); 124 | for field in fields { 125 | let rust_name = &field.rust_name; 126 | let sql_name = &field.sql_name; 127 | struct_lines.push(quote!( 128 | #rust_name : row.try_get(#sql_name)? 129 | )); 130 | } 131 | 132 | // Build the output. 133 | let expanded = quote! { 134 | impl FromSql for #name { 135 | fn from_row(row: &Row) -> Result where Self: Sized { 136 | Ok(Self { 137 | #(#struct_lines),* 138 | }) 139 | } 140 | } 141 | }; 142 | expanded.into() 143 | } 144 | -------------------------------------------------------------------------------- /sprattus/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! A crate for easy Postgres database communication. 2 | //! 3 | //! # Getting started 4 | //! 5 | //! Add sprattus to your cargo.toml: 6 | //! ```toml 7 | //! sprattus = "0.1" 8 | //! ``` 9 | //! Create a table in Postgres: 10 | //! ```sql 11 | //! CREATE TABLE fruits( 12 | //! id SERIAL PRIMARY KEY, 13 | //! name VARCHAR NOT NULL 14 | //! ); 15 | //! ``` 16 | //! 17 | //! Create a struct corresponding to the created table: 18 | //! ```no_run 19 | //! struct Fruit { 20 | //! id: i32, 21 | //! name: String 22 | //! } 23 | //! ``` 24 | //! And finally add the sprattus macro's and annotations: 25 | //! ```no_run 26 | //! use sprattus::*; 27 | //! 28 | //! #[derive(ToSql, FromSql, Debug)] 29 | //! #[sql(table = "fruits")] 30 | //! struct Fruit { 31 | //! #[sql(primary_key)] 32 | //! id: i32, 33 | //! name: String 34 | //! } 35 | //! ``` 36 | //! And now your ready to use the client in combination with you freshly created struct! 37 | //! 38 | //! ```no_run 39 | //! use tokio::prelude::*; 40 | //! use sprattus::*; 41 | //! 42 | //! #[derive(ToSql, FromSql, Debug)] 43 | //! #[sql(table = "fruits")] 44 | //! struct Fruit { 45 | //! #[sql(primary_key)] 46 | //! id: i32, 47 | //! name: String 48 | //! } 49 | //! 50 | //! #[tokio::main] 51 | //! async fn main() -> Result<(), Error>{ 52 | //! let conn = Connection::new("postgresql://! localhost/dellstore2?user=tg").await?; 53 | //! let fruit = Fruit{ 54 | //! id: 0, 55 | //! name: String::from("apple") 56 | //! }; 57 | //! // Insert created fruit into the database. 58 | //! let created_fruit = conn.create(&fruit).await?; 59 | //! dbg!(created_fruit); 60 | //! Ok(()) 61 | //! } 62 | //! ``` 63 | //! 64 | //! # Types 65 | //! The following Rust types are provided by this crate for use in user created Rust structs, along with the 66 | //! corresponding Postgres types: 67 | //! 68 | //! | Rust type | Postgres type(s) | 69 | //! |-----------------------------------|-----------------------------------------------| 70 | //! | `bool` | BOOL | 71 | //! | `i8` | "char" | 72 | //! | `i16` | SMALLINT, SMALLSERIAL | 73 | //! | `i32` | INT, SERIAL | 74 | //! | `u32` | OID | 75 | //! | `i64` | BIGINT, BIGSERIAL | 76 | //! | `f32` | REAL | 77 | //! | `f64` | DOUBLE PRECISION | 78 | //! | `&str`/`String` | VARCHAR, CHAR(n), TEXT, CITEXT, NAME, UNKNOWN | 79 | //! | `&[u8]`/`Vec` | BYTEA | 80 | //! | `HashMap>` | HSTORE | 81 | //! | `SystemTime` | TIMESTAMP, TIMESTAMP WITH TIME ZONE | 82 | //! | `IpAddr` | INET | 83 | //! 84 | //! In addition, some implementations are provided for types in third party 85 | //! crates. These are disabled by default; to opt into one of these 86 | //! implementations, activate the Cargo feature corresponding to the crate's 87 | //! name prefixed by `with-`. For example, the `with-serde_json-1` feature enables 88 | //! the implementation for the `serde_json::Value` type. 89 | //! 90 | //! | Rust type | Postgres type(s) | 91 | //! |---------------------------------|-------------------------------------| 92 | //! | `chrono::NaiveDateTime` | TIMESTAMP | 93 | //! | `chrono::DateTime` | TIMESTAMP WITH TIME ZONE | 94 | //! | `chrono::DateTime` | TIMESTAMP WITH TIME ZONE | 95 | //! | `chrono::DateTime` | TIMESTAMP WITH TIME ZONE | 96 | //! | `chrono::NaiveDate` | DATE | 97 | //! | `chrono::NaiveTime` | TIME | 98 | //! | `eui48::MacAddress` | MACADDR | 99 | //! | `geo_types::Point` | POINT | 100 | //! | `geo_types::Rect` | BOX | 101 | //! | `geo_types::LineString` | PATH | 102 | //! | `serde_json::Value` | JSON, JSONB | 103 | //! | `uuid::Uuid` | UUID | 104 | //! | `bit_vec::BitVec` | BIT, VARBIT | 105 | //! | `eui48::MacAddress` | MACADDR | 106 | //! 107 | //! ### Nullability 108 | //! 109 | //! In addition to the types listed above, `FromSqlItem` is implemented for 110 | //! `Option` where `T` implements `FromSqlItem`. An `Option` represents a 111 | //! nullable Postgres value. 112 | //! 113 | //! # Annotations 114 | //! 115 | //! On user created structs, there are several options configurable by using annotiations. 116 | //! ### Renaming fields 117 | //! In any case of having not the same name for a field in the database and in Rust, use the rename annotation. 118 | //! ```no_run 119 | //! # use sprattus::*; 120 | //! # #[derive(ToSql)] 121 | //! struct Product { 122 | //! #[sql(primary_key)] 123 | //! id: i32, 124 | //! name: String, 125 | //! // Renames the postgres field 'product_price' to costs. 126 | //! #[sql(name = "product_price")] 127 | //! costs: f64 128 | //! } 129 | //! ``` 130 | //! ### Selecting a primary key 131 | //! Every struct that wants to use the `ToSql` derive macro needs to have a primary key. 132 | //! Therefore there is a annotion available for that. 133 | //! ```no_run 134 | //! # use sprattus::*; 135 | //! # #[derive(ToSql)] 136 | //! struct User { 137 | //! // Annotates id as primary key of the table. 138 | //! #[sql(primary_key)] 139 | //! id: i32, 140 | //! name: String, 141 | //! } 142 | //! ``` 143 | //! ### Selecting a database table 144 | //! In many cases, the name of your Rust struct will not correspond with the table in Postgres. 145 | //! To solve that problem, there is a attribute to select the table belonging to the created struct: 146 | //! ```no_run 147 | //! # use sprattus::*; 148 | //! // This tells sprattus to use the 'houses' table in Postgres. 149 | //! #[derive(ToSql)] 150 | //! #[sql(table = "houses")] 151 | //! struct House { 152 | //! #[sql(primary_key)] 153 | //! id: i32, 154 | //! address: String, 155 | //! city: String, 156 | //! country: String, 157 | //! } 158 | //! ``` 159 | 160 | mod connection; 161 | mod traits; 162 | 163 | pub use self::connection::Connection; 164 | pub use self::traits::{FromSql, ToSql}; 165 | pub use sprattus_derive::{FromSql, ToSql}; 166 | pub use tokio_postgres::types::ToSql as ToSqlItem; 167 | pub use tokio_postgres::{Error, Row}; 168 | -------------------------------------------------------------------------------- /sprattus-derive/src/functions.rs: -------------------------------------------------------------------------------- 1 | extern crate proc_macro; 2 | 3 | use crate::to_sql::KeyType::{NoKey, PrimaryKey, PrimaryKeyCandidate}; 4 | use crate::to_sql::*; 5 | use proc_macro2::TokenTree::{Group, Ident as Ident2, Punct}; 6 | use proc_macro2::{Ident, Literal, Span, TokenTree}; 7 | use syn::PathArguments::AngleBracketed; 8 | use syn::Type::Path; 9 | use syn::{Attribute, Field, GenericArgument, Type}; 10 | 11 | pub(crate) fn get_field_name(field: &Field) -> Ident { 12 | match &field.ident { 13 | Some(ident) => ident.clone(), 14 | _ => panic!("Could not find a name for one of the fields in your struct"), 15 | } 16 | } 17 | 18 | #[allow(clippy::unnecessary_operation)] 19 | pub(crate) fn get_table_name_from_attributes(attributes: Vec) -> Option { 20 | for attribute in attributes { 21 | match attribute.path.segments.first() { 22 | Some(segment) => { 23 | if !segment.ident.to_string().eq("sql") { 24 | continue; 25 | } 26 | } 27 | None => continue, 28 | } 29 | for item in attribute.tokens { 30 | match item { 31 | Group(group) => { 32 | for token in group.stream() { 33 | match token { 34 | Ident2(ident) => { 35 | if !ident.to_string().eq("table") { 36 | break; 37 | } 38 | } 39 | Punct(punct) => { 40 | if punct.as_char() != '=' { 41 | break; 42 | } 43 | } 44 | TokenTree::Literal(literal) => { 45 | return Some(literal.to_string().replace("\"", "")); 46 | } 47 | _ => break, 48 | } 49 | } 50 | } 51 | _ => break, 52 | } 53 | } 54 | } 55 | None 56 | } 57 | 58 | pub(crate) fn get_key_value_of_attribute(tokens: proc_macro2::Group) -> (Ident, Option) { 59 | let mut name: Ident = Ident::new("temp", Span::call_site()); 60 | for token in tokens.stream() { 61 | match token { 62 | Ident2(ident) => { 63 | name = ident; 64 | } 65 | Punct(punct) => { 66 | if punct.as_char() != '=' { 67 | return (name, None); 68 | } 69 | } 70 | TokenTree::Literal(literal) => { 71 | return (name, Some(literal)); 72 | } 73 | _ => {} 74 | } 75 | } 76 | (name, None) 77 | } 78 | 79 | pub(crate) fn generate_argument_list(length: usize) -> String { 80 | let mut prepared_arguments_list = String::new(); 81 | for i in 1..=length { 82 | if i == length { 83 | prepared_arguments_list.push_str(format!("${}", i).as_str()); 84 | } else { 85 | prepared_arguments_list.push_str(format!("${},", i).as_str()); 86 | } 87 | } 88 | prepared_arguments_list 89 | } 90 | pub(crate) fn generate_field_list(field_list: &[String]) -> String { 91 | let mut field_list_str = String::new(); 92 | for (i, field) in field_list.iter().enumerate() { 93 | let field = if !field.starts_with('"') { 94 | format!("\"{}\"", field.as_str()) 95 | } else { 96 | field.clone() 97 | }; 98 | if i == field_list.len() - 1 { 99 | field_list_str.push_str(field.as_str()); 100 | } else { 101 | field_list_str.push_str(format!("{},", field.as_str()).as_str()); 102 | } 103 | } 104 | field_list_str 105 | } 106 | 107 | pub(crate) fn get_ident_name_from_path(path: &Type) -> Ident { 108 | match path { 109 | Path(path) => match path.path.get_ident() { 110 | Some(ident) => ident.clone(), 111 | None => { 112 | // Handle generic types like Option. 113 | if let Some(path_segement) = &path.path.segments.first() { 114 | if let AngleBracketed(arguments) = &path_segement.arguments { 115 | if let Some(GenericArgument::Type(generic_type)) = arguments.args.first() { 116 | return get_ident_name_from_path(generic_type); 117 | } 118 | } 119 | } 120 | panic!("Could not infer type information of your struct") 121 | } 122 | }, 123 | _ => panic!("not found a path"), 124 | } 125 | } 126 | 127 | pub(crate) fn is_sprattus_attribute(attribute: &Attribute) -> bool { 128 | match attribute.path.get_ident() { 129 | Some(name) => name.eq("sql"), 130 | _ => false, 131 | } 132 | } 133 | 134 | pub(crate) fn generate_argument_list_with_types(fields: &[StructFieldData]) -> String { 135 | let mut prepared_arguments_list = String::new(); 136 | for (i, pg_type) in fields.iter().map(|field| &field.pg_field_type).enumerate() { 137 | if i == (fields.len() - 1) { 138 | prepared_arguments_list.push_str(format!("${}::{}", i + 1, pg_type).as_str()); 139 | } else { 140 | prepared_arguments_list.push_str(format!("${}::{},", i + 1, pg_type).as_str()); 141 | } 142 | } 143 | prepared_arguments_list 144 | } 145 | 146 | pub(crate) fn find_field_table_name(field: &Field) -> Option { 147 | for attribute in field.attrs.clone() { 148 | if !is_sprattus_attribute(&attribute) { 149 | continue; 150 | } 151 | for token in attribute.tokens { 152 | match token { 153 | Group(group) => match get_key_value_of_attribute(group) { 154 | (ident, Some(name)) => { 155 | if ident.to_string().eq("name") { 156 | return Some(name); 157 | } 158 | } 159 | _ => break, 160 | }, 161 | _ => { 162 | break; 163 | } 164 | } 165 | } 166 | } 167 | None 168 | } 169 | 170 | pub(crate) fn find_key_type(field: &Field) -> KeyType { 171 | for attribute in field.attrs.clone() { 172 | if !is_sprattus_attribute(&attribute) { 173 | continue; 174 | } 175 | for token in attribute.tokens { 176 | match token { 177 | Group(group) => match get_key_value_of_attribute(group) { 178 | (ident, Some(_name)) => { 179 | if ident.to_string().eq("primary_key") { 180 | return PrimaryKey; 181 | } 182 | } 183 | (ident, None) => { 184 | if ident.to_string().eq("primary_key") { 185 | return PrimaryKey; 186 | } 187 | } 188 | }, 189 | _ => { 190 | break; 191 | } 192 | } 193 | } 194 | } 195 | if let Some(name) = &field.ident { 196 | if name.to_string().contains("id") { 197 | return PrimaryKeyCandidate; 198 | } 199 | } 200 | NoKey 201 | } 202 | 203 | pub(crate) fn get_postgres_datatype(rust_type: String) -> String { 204 | match rust_type.as_str() { 205 | "bool" => String::from("BOOL"), 206 | "str" => String::from("VARCHAR"), 207 | "i8" => String::from("CHAR"), 208 | "i16" => String::from("SMALLINT"), 209 | "i32" => String::from("INT"), 210 | "u32" => String::from("OID"), 211 | "i64" => String::from("BIGINT"), 212 | "f32" => String::from("REAL"), 213 | "f64" => String::from("DOUBLE PRECISION"), 214 | "String" => String::from("VARCHAR"), 215 | "NaiveTime" => String::from("TIME"), 216 | "NaiveDate" => String::from("DATE"), 217 | "Uuid" => String::from("UUID"), 218 | "NaiveDateTime" => String::from("TIMESTAMP"), 219 | "Json" => String::from("JSON"), 220 | "MacAddress" => String::from("MACADDR"), 221 | _ => panic!("unsupported type"), 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /sprattus/src/connection.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | use futures_util::future::FutureExt; 3 | use futures_util::future::TryFutureExt; 4 | use std::collections::HashMap; 5 | use std::sync::Arc; 6 | use strfmt::strfmt; 7 | use tokio; 8 | use tokio_postgres::*; 9 | 10 | /// Client for Postgres database manipulation. 11 | /// 12 | /// 13 | #[derive(Clone)] 14 | pub struct Connection { 15 | client: Arc, 16 | } 17 | 18 | impl Connection { 19 | /// 20 | /// Creates a new connection to the database. 21 | /// 22 | /// Example: 23 | /// ```no_run 24 | /// use sprattus::*; 25 | /// 26 | ///# #[tokio::main] 27 | ///# async fn main() -> Result<(), Error> { 28 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 29 | ///# return Ok(()) 30 | ///# } 31 | /// ``` 32 | pub async fn new(connection_string: &str) -> Result { 33 | let (client, connection) = tokio_postgres::connect(connection_string, NoTls).await?; 34 | 35 | let connection = connection 36 | .map_err(|e| panic!("connection error: {}", e)) 37 | .map(|conn| conn.unwrap()); 38 | tokio::spawn(connection); 39 | Ok(Self { 40 | client: Arc::new(client), 41 | }) 42 | } 43 | /// Executes a statement, returning the number of rows modified. 44 | /// 45 | /// If the statement does not modify any rows (e.g. `SELECT`), 0 is returned. 46 | /// 47 | /// # Panics 48 | /// 49 | /// Panics if the number of parameters provided does not match the number expected. 50 | pub async fn execute(&self, sql: &str, args: &[&(dyn ToSqlItem + Sync)]) -> Result { 51 | let client = &self.client; 52 | client.execute(sql, args).await 53 | } 54 | 55 | /// Executes a sequence of SQL statements using the simple query protocol. 56 | /// 57 | /// Statements should be separated by semicolons. If an error occurs, execution of the sequence will stop at that 58 | /// point. This is intended for use when, for example, initializing a database schema. 59 | /// 60 | /// # Warning 61 | /// 62 | /// Prepared statements should be use for any query which contains user-specified data, as they provided the 63 | /// functionality to safely embed that data in the request. Do not form statements via string concatenation and pass 64 | /// them to this method! 65 | pub async fn batch_execute(&self, sql: &str) -> Result<(), Error> { 66 | let client = &self.client; 67 | let result = { client.batch_execute(&sql) }; 68 | result.await 69 | } 70 | 71 | /// 72 | /// Query multiple rows of a table. 73 | /// 74 | /// Example: 75 | /// ```no_run 76 | ///# use sprattus::*; 77 | ///# use tokio::prelude::*; 78 | ///# 79 | ///# #[derive(FromSql, Eq, PartialEq, Debug)] 80 | ///# struct Product { 81 | ///# #[sql(primary_key)] 82 | ///# prod_id: i32, 83 | ///# title: String 84 | ///# } 85 | ///# #[tokio::main] 86 | ///# async fn main() -> Result<(), Error> { 87 | ///# 88 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 89 | ///# 90 | ///# 91 | ///# 92 | /// let product_list : Vec = 93 | /// conn.query_multiple("SELECT * FROM Products LIMIT 3", &[]).await?; 94 | /// assert_eq!(product_list, 95 | /// vec!( 96 | /// Product { 97 | /// prod_id : 1, 98 | /// title : String::from("ACADEMY ACADEMY") 99 | /// }, 100 | /// Product { 101 | /// prod_id : 2, 102 | /// title : String::from("ACADEMY ACE") 103 | /// }, 104 | /// Product { 105 | /// prod_id : 3, 106 | /// title : String::from("ACADEMY ADAPTATION") 107 | /// })); 108 | ///# Ok(()) 109 | ///# } 110 | /// ``` 111 | pub async fn query_multiple( 112 | &self, 113 | sql: &str, 114 | args: &[&(dyn ToSqlItem + Sync)], 115 | ) -> Result, Error> 116 | where 117 | T: FromSql, 118 | { 119 | self.client 120 | .query(sql, args) 121 | .map(|rows| rows?.iter().map(|row| T::from_row(row)).collect()) 122 | .await 123 | } 124 | 125 | /// 126 | /// Get a single row of a table. 127 | /// 128 | /// Example: 129 | /// ```no_run 130 | /// use sprattus::*; 131 | /// use tokio::prelude::*; 132 | /// 133 | /// #[derive(FromSql, Eq, PartialEq, Debug)] 134 | /// struct Product { 135 | /// #[sql(primary_key)] 136 | /// prod_id: i32, 137 | /// title: String 138 | /// } 139 | /// 140 | /// #[tokio::main] 141 | /// async fn main() -> Result<(), Error> { 142 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 143 | /// let product : Product = conn.query("SELECT * FROM Products LIMIT 1", &[]).await?; 144 | /// assert_eq!(product, Product{ prod_id: 1, title: String::from("ACADEMY ACADEMY")}); 145 | /// Ok(()) 146 | /// } 147 | /// ``` 148 | pub async fn query(&self, sql: &str, args: &[&(dyn ToSqlItem + Sync)]) -> Result 149 | where 150 | T: FromSql, 151 | { 152 | let client = &self.client; 153 | T::from_row(&client.query_one(sql, args).await?) 154 | } 155 | 156 | /// 157 | /// Update a single rust value in the database. 158 | /// 159 | /// Example: 160 | /// ```no_run 161 | /// use sprattus::*; 162 | /// use tokio::prelude::*; 163 | /// 164 | /// #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] 165 | /// struct Product { 166 | /// #[sql(primary_key)] 167 | /// prod_id: i32, 168 | /// title: String 169 | /// } 170 | /// 171 | /// #[tokio::main] 172 | /// async fn main() -> Result<(), Error> { 173 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 174 | /// // Change a existing record in the database. 175 | /// conn.update(&Product { prod_id : 50, title: String::from("Rust ORM")}).await?; 176 | /// 177 | /// let product : Product = conn.query("SELECT * FROM Products where prod_id = 50", &[]).await?; 178 | /// assert_eq!(product, Product{ prod_id: 50, title: String::from("Rust ORM")}); 179 | /// // Change it back to it's original value. 180 | /// conn.update(&Product { prod_id : 50, title: String::from("ACADEMY BAKED")}).await?; 181 | /// 182 | /// let product : Product = conn.query("SELECT * FROM Products where prod_id = 50", &[]).await?; 183 | /// assert_eq!(product, Product{ prod_id: 50, title: String::from("ACADEMY BAKED")}); 184 | /// Ok(()) 185 | /// } 186 | /// ``` 187 | pub async fn update(&self, item: &T) -> Result 188 | where 189 | ::PK: tokio_postgres::types::ToSql, 190 | { 191 | // FIXME: change this to a const fn, see https://github.com/rust-lang/rust/issues/57563 192 | let sql_template = if T::get_prepared_arguments_list() == "$1" { 193 | "UPDATE {table_name} SET {fields} = {prepared_values} WHERE {primary_key} = $1 RETURNING *" 194 | } else { 195 | "UPDATE {table_name} SET ({fields}) = ({prepared_values}) WHERE {primary_key} = $1 RETURNING *" 196 | }; 197 | let mut sql_vars = HashMap::with_capacity(12); 198 | sql_vars.insert(String::from("table_name"), T::get_table_name()); 199 | sql_vars.insert(String::from("fields"), T::get_fields()); 200 | sql_vars.insert(String::from("primary_key"), T::get_primary_key()); 201 | let prepared_values = 202 | generate_single_prepared_arguments_list(2, T::get_argument_count() + 1); 203 | sql_vars.insert(String::from("prepared_values"), prepared_values.as_ref()); 204 | let sql = strfmt(sql_template, &sql_vars).unwrap(); 205 | let client = &self.client; 206 | 207 | T::from_row( 208 | &client 209 | .query_one(sql.as_str(), item.get_values_of_all_fields().as_slice()) 210 | .await?, 211 | ) 212 | } 213 | 214 | /// 215 | /// Update multiple rust values in the database. 216 | /// 217 | /// Example: 218 | /// ```no_run 219 | /// use sprattus::*; 220 | /// use tokio::prelude::*; 221 | /// 222 | /// #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] 223 | /// struct Product { 224 | /// #[sql(primary_key)] 225 | /// prod_id: i32, 226 | /// title: String 227 | /// } 228 | /// 229 | /// #[tokio::main] 230 | /// async fn main() -> Result<(), Error> { 231 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 232 | /// let new_products = vec!( 233 | /// Product{ prod_id: 60, title: String::from("Rust ACADEMY") }, 234 | /// Product{ prod_id: 61, title: String::from("SQL ACADEMY") }, 235 | /// Product{ prod_id: 62, title: String::from("Backend development training") }, 236 | /// ); 237 | /// // Change a existing record in the database. 238 | /// conn.update_multiple(&new_products).await?; 239 | /// let sql = "SELECT * FROM Products where prod_id in (60, 61, 62)"; 240 | /// let products: Vec = conn.query_multiple(sql, &[]).await?; 241 | /// assert_eq!(products, new_products); 242 | /// Ok(()) 243 | /// } 244 | /// ``` 245 | pub async fn update_multiple(&self, items: &[T]) -> Result, Error> 246 | where 247 | T: Sized + ToSql + FromSql, 248 | { 249 | // TODO: change this to a const fn, see https://github.com/rust-lang/rust/issues/57563 250 | let sql_template = if T::get_prepared_arguments_list() == "$1" { 251 | "UPDATE {table_name} AS P SET {fields} = temp_table.{inner_fields} FROM \ 252 | (VALUES {prepared_placeholders}) as temp_table({all_fields}) \ 253 | WHERE P.{primary_key} = temp_table.{primary_key} \ 254 | RETURNING *" 255 | } else { 256 | "UPDATE {table_name} AS P SET ({fields}) = (temp_table.{inner_fields}) FROM \ 257 | (VALUES {prepared_placeholders}) as temp_table({all_fields}) \ 258 | WHERE P.{primary_key} = temp_table.{primary_key} \ 259 | RETURNING *" 260 | }; 261 | let placeholders = generate_prepared_arguments_list_with_types::( 262 | T::get_argument_count() + 1, 263 | items.len(), 264 | ); 265 | let inner_fields = T::get_fields().replace(",", ",temp_table."); 266 | let mut sql_vars = HashMap::with_capacity(12); 267 | sql_vars.insert(String::from("table_name"), T::get_table_name()); 268 | sql_vars.insert(String::from("inner_fields"), inner_fields.as_str()); 269 | sql_vars.insert(String::from("fields"), T::get_fields()); 270 | sql_vars.insert(String::from("primary_key"), T::get_primary_key()); 271 | sql_vars.insert(String::from("all_fields"), T::get_all_fields()); 272 | sql_vars.insert(String::from("prepared_placeholders"), placeholders.as_str()); 273 | let sql = strfmt(sql_template, &sql_vars).unwrap(); 274 | let params: Vec<&(dyn ToSqlItem + Sync)> = items 275 | .iter() 276 | .map(|item| item.get_values_of_all_fields()) 277 | .flatten() 278 | .collect(); 279 | let client = &self.client; 280 | client 281 | .query(sql.as_str(), params.as_slice()) 282 | .map(|rows| rows?.iter().map(|row| T::from_row(row)).collect()) 283 | .await 284 | } 285 | 286 | /// 287 | /// Create a new row in the database. 288 | /// 289 | /// Example: 290 | /// ```no_run 291 | /// use sprattus::*; 292 | /// use tokio::prelude::*; 293 | /// 294 | /// #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] 295 | /// struct Product { 296 | /// #[sql(primary_key)] 297 | /// prod_id: i32, 298 | /// title: String 299 | /// } 300 | /// 301 | /// #[tokio::main] 302 | /// async fn main() -> Result<(), Error> { 303 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 304 | /// let new_product = Product {prod_id: 0, title: String::from("Sql insert lesson")}; 305 | /// let product = conn.create(&new_product).await?; 306 | /// 307 | /// assert_eq!(new_product, product); 308 | /// Ok(()) 309 | /// } 310 | /// ``` 311 | pub async fn create(&self, item: &T) -> Result 312 | where 313 | T: Sized + ToSql + FromSql, 314 | { 315 | let sql = format!( 316 | "INSERT INTO {table_name} ({fields}) values ({prepared_values}) RETURNING *", 317 | table_name = T::get_table_name(), 318 | fields = T::get_fields(), 319 | prepared_values = T::get_prepared_arguments_list(), 320 | ); 321 | let client = &self.client; 322 | 323 | T::from_row( 324 | &client 325 | .query_one(sql.as_str(), item.get_query_params().as_slice()) 326 | .await?, 327 | ) 328 | } 329 | 330 | /// 331 | /// Create new rows in the database. 332 | /// 333 | /// Example: 334 | /// ```no_run 335 | /// use sprattus::*; 336 | /// use tokio::prelude::*; 337 | /// 338 | /// #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] 339 | /// struct Product { 340 | /// #[sql(primary_key)] 341 | /// prod_id: i32, 342 | /// title: String 343 | /// } 344 | /// 345 | /// #[tokio::main] 346 | /// async fn main() -> Result<(), Error> { 347 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 348 | /// let new_products = vec!( 349 | /// Product {prod_id: 0, title: String::from("Sql insert lesson")}, 350 | /// Product {prod_id: 0, title: String::from("Rust macro lesson")}, 351 | /// Product {prod_id: 0, title: String::from("Postgres data types lesson")} 352 | /// ); 353 | /// let products = conn.create_multiple(&new_products).await?; 354 | /// 355 | /// assert_eq!(&new_products, &products); 356 | /// 357 | /// conn.delete_multiple(&products).await?; 358 | /// Ok(()) 359 | /// } 360 | /// ``` 361 | pub async fn create_multiple(&self, items: &[T]) -> Result, Error> 362 | where 363 | T: Sized + ToSql + FromSql, 364 | { 365 | let sql = format!( 366 | "INSERT INTO {table_name} ({fields}) values {prepared_values} RETURNING *", 367 | table_name = T::get_table_name(), 368 | fields = T::get_fields(), 369 | prepared_values = 370 | generate_prepared_arguments_list(T::get_argument_count(), items.len()), 371 | ); 372 | 373 | let params: Vec<&(dyn ToSqlItem + Sync)> = items 374 | .iter() 375 | .map(|item| item.get_query_params()) 376 | .flatten() 377 | .collect(); 378 | let client = &self.client; 379 | client 380 | .query(sql.as_str(), params.as_slice()) 381 | .map(|rows| rows?.iter().map(|row| T::from_row(row)).collect()) 382 | .await 383 | } 384 | 385 | /// 386 | /// Deletes a item. 387 | /// 388 | /// Example: 389 | /// ```no_run 390 | /// use sprattus::*; 391 | /// use tokio::prelude::*; 392 | /// 393 | /// #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] 394 | /// struct Product { 395 | /// #[sql(primary_key)] 396 | /// prod_id: i32, 397 | /// title: String 398 | /// } 399 | /// 400 | /// #[tokio::main] 401 | /// async fn main() -> Result<(), Error> { 402 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 403 | /// 404 | /// let new_product = Product {prod_id: 0, title: String::from("Sql insert lesson")}; 405 | /// let product = conn.create(&new_product).await?; 406 | /// let deleted_product = conn.delete(&product).await?; 407 | /// 408 | /// assert_eq!(&product, &deleted_product); 409 | /// Ok(()) 410 | /// } 411 | /// ``` 412 | pub async fn delete(&self, item: &T) -> Result 413 | where 414 | ::PK: tokio_postgres::types::ToSql + Sync, 415 | { 416 | let sql = format!( 417 | "DELETE FROM {table_name} WHERE {primary_key} IN ($1) RETURNING *", 418 | table_name = T::get_table_name(), 419 | primary_key = T::get_primary_key() 420 | ); 421 | let client = &self.client; 422 | T::from_row( 423 | &client 424 | .query_one(sql.as_str(), &[&item.get_primary_key_value()]) 425 | .await?, 426 | ) 427 | } 428 | 429 | /// 430 | /// Deletes a list of items. 431 | /// 432 | /// Example: 433 | /// ```no_run 434 | /// use sprattus::*; 435 | /// use tokio::prelude::*; 436 | /// 437 | /// #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] 438 | /// struct Product { 439 | /// #[sql(primary_key)] 440 | /// prod_id: i32, 441 | /// title: String 442 | /// } 443 | /// 444 | /// #[tokio::main] 445 | /// async fn main() -> Result<(), Error> { 446 | /// let conn = Connection::new("postgresql://localhost?user=tg").await?; 447 | /// let new_products = vec!( 448 | /// Product {prod_id: 0, title: String::from("Sql insert lesson")}, 449 | /// Product {prod_id: 0, title: String::from("Rust macro lesson")}, 450 | /// Product {prod_id: 0, title: String::from("Postgres data types lesson")} 451 | /// ); 452 | /// let created_products = conn.create_multiple(&new_products).await?; 453 | /// 454 | /// let deleted_products = conn.delete_multiple(&created_products).await?; 455 | /// assert_eq!(&created_products, &deleted_products); 456 | /// Ok(()) 457 | /// } 458 | /// ``` 459 | pub async fn delete_multiple(&self, items: &[T]) -> Result, Error> 460 | where 461 | P: tokio_postgres::types::ToSql, 462 | T: traits::FromSql + traits::ToSql, 463 | ::PK: Sync, 464 | { 465 | let sql = format!( 466 | "DELETE FROM {table_name} WHERE {primary_key} IN ({argument_list}) RETURNING *", 467 | table_name = T::get_table_name(), 468 | primary_key = T::get_primary_key(), 469 | argument_list = generate_single_prepared_arguments_list(1, items.len()) 470 | ); 471 | let params: Vec

= items 472 | .iter() 473 | .map(|item| item.get_primary_key_value()) 474 | .collect(); 475 | let p = params 476 | .iter() 477 | .map(|i| i as &(dyn tokio_postgres::types::ToSql + Sync)) 478 | .collect::>(); 479 | let client = &self.client; 480 | client 481 | .query(sql.as_str(), p.as_slice()) 482 | .map(|rows| rows?.iter().map(|row| T::from_row(row)).collect()) 483 | .await 484 | } 485 | } 486 | /// 487 | /// Generates a string of prepared statement placeholder arguments. 488 | /// 489 | fn generate_prepared_arguments_list(item_length: usize, no_of_items: usize) -> String { 490 | let mut arguments_list: String = String::new(); 491 | let range_end = item_length * no_of_items + 1; 492 | 493 | complete_prepared_arguments_list(&mut arguments_list, 1, range_end, item_length); 494 | arguments_list 495 | } 496 | 497 | fn generate_prepared_arguments_list_with_types(item_length: usize, no_of_items: usize) -> String 498 | where 499 | T: ToSql, 500 | { 501 | let mut arguments_list: String = format!("({})", T::get_prepared_arguments_list_with_types()); 502 | if no_of_items == 1 { 503 | return arguments_list; 504 | } 505 | let range_end = item_length * no_of_items + 1; 506 | arguments_list.push(','); 507 | complete_prepared_arguments_list(&mut arguments_list, item_length + 1, range_end, item_length); 508 | arguments_list 509 | } 510 | 511 | fn complete_prepared_arguments_list( 512 | arguments_list: &mut String, 513 | range_start: usize, 514 | range_end: usize, 515 | item_length: usize, 516 | ) { 517 | let mut first: bool = true; 518 | 519 | for i in range_start..range_end { 520 | if (i - 1) % item_length == 0 { 521 | if first { 522 | first = false; 523 | } else { 524 | arguments_list.push_str("),"); 525 | } 526 | arguments_list.push('('); 527 | } else { 528 | arguments_list.push(','); 529 | } 530 | arguments_list.push('$'); 531 | arguments_list.push_str(&*i.to_string()); 532 | } 533 | arguments_list.push(')'); 534 | } 535 | 536 | fn generate_single_prepared_arguments_list(start_num: usize, end_num: usize) -> String { 537 | let mut arguments_list: String = String::new(); 538 | for i in start_num..=end_num { 539 | arguments_list.push('$'); 540 | arguments_list.push_str(&*i.to_string()); 541 | if i != end_num { 542 | arguments_list.push(','); 543 | } 544 | } 545 | arguments_list 546 | } 547 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "autocfg" 5 | version = "0.1.6" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | 8 | [[package]] 9 | name = "base64" 10 | version = "0.11.0" 11 | source = "registry+https://github.com/rust-lang/crates.io-index" 12 | 13 | [[package]] 14 | name = "bit-vec" 15 | version = "0.6.1" 16 | source = "registry+https://github.com/rust-lang/crates.io-index" 17 | 18 | [[package]] 19 | name = "bitflags" 20 | version = "1.2.1" 21 | source = "registry+https://github.com/rust-lang/crates.io-index" 22 | 23 | [[package]] 24 | name = "block-buffer" 25 | version = "0.7.3" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | dependencies = [ 28 | "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 29 | "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 30 | "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 31 | "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 32 | ] 33 | 34 | [[package]] 35 | name = "block-padding" 36 | version = "0.1.4" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | dependencies = [ 39 | "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 40 | ] 41 | 42 | [[package]] 43 | name = "byte-tools" 44 | version = "0.3.1" 45 | source = "registry+https://github.com/rust-lang/crates.io-index" 46 | 47 | [[package]] 48 | name = "byteorder" 49 | version = "1.3.2" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | 52 | [[package]] 53 | name = "bytes" 54 | version = "0.5.3" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | 57 | [[package]] 58 | name = "c2-chacha" 59 | version = "0.2.3" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | dependencies = [ 62 | "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 63 | ] 64 | 65 | [[package]] 66 | name = "cfg-if" 67 | version = "0.1.10" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | 70 | [[package]] 71 | name = "chrono" 72 | version = "0.4.9" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | dependencies = [ 75 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 76 | "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", 77 | "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 78 | "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 79 | ] 80 | 81 | [[package]] 82 | name = "cloudabi" 83 | version = "0.0.3" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | dependencies = [ 86 | "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 87 | ] 88 | 89 | [[package]] 90 | name = "crypto-mac" 91 | version = "0.7.0" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | dependencies = [ 94 | "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 95 | "subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 96 | ] 97 | 98 | [[package]] 99 | name = "digest" 100 | version = "0.8.1" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | dependencies = [ 103 | "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 104 | ] 105 | 106 | [[package]] 107 | name = "eui48" 108 | version = "0.4.6" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | dependencies = [ 111 | "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", 112 | ] 113 | 114 | [[package]] 115 | name = "fake-simd" 116 | version = "0.1.2" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | 119 | [[package]] 120 | name = "fallible-iterator" 121 | version = "0.2.0" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | 124 | [[package]] 125 | name = "fuchsia-zircon" 126 | version = "0.3.3" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | dependencies = [ 129 | "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 130 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 131 | ] 132 | 133 | [[package]] 134 | name = "fuchsia-zircon-sys" 135 | version = "0.3.3" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | 138 | [[package]] 139 | name = "futures" 140 | version = "0.3.1" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | dependencies = [ 143 | "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 144 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 145 | "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 146 | "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 147 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 148 | "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 149 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 150 | ] 151 | 152 | [[package]] 153 | name = "futures-channel" 154 | version = "0.3.1" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | dependencies = [ 157 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 158 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 159 | ] 160 | 161 | [[package]] 162 | name = "futures-core" 163 | version = "0.3.1" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | 166 | [[package]] 167 | name = "futures-executor" 168 | version = "0.3.1" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | dependencies = [ 171 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 172 | "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 173 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 174 | ] 175 | 176 | [[package]] 177 | name = "futures-io" 178 | version = "0.3.1" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | 181 | [[package]] 182 | name = "futures-macro" 183 | version = "0.3.1" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | dependencies = [ 186 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", 187 | "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 188 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 189 | "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 190 | ] 191 | 192 | [[package]] 193 | name = "futures-sink" 194 | version = "0.3.1" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | 197 | [[package]] 198 | name = "futures-task" 199 | version = "0.3.1" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | 202 | [[package]] 203 | name = "futures-util" 204 | version = "0.3.1" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | dependencies = [ 207 | "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 208 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 209 | "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 210 | "futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 211 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 212 | "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 213 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 214 | "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", 215 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", 216 | "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 217 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 218 | ] 219 | 220 | [[package]] 221 | name = "generic-array" 222 | version = "0.12.3" 223 | source = "registry+https://github.com/rust-lang/crates.io-index" 224 | dependencies = [ 225 | "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", 226 | ] 227 | 228 | [[package]] 229 | name = "generic-array" 230 | version = "0.13.2" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | dependencies = [ 233 | "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", 234 | ] 235 | 236 | [[package]] 237 | name = "geo-types" 238 | version = "0.4.3" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | dependencies = [ 241 | "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 242 | ] 243 | 244 | [[package]] 245 | name = "getrandom" 246 | version = "0.1.14" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | dependencies = [ 249 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 250 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 251 | "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", 252 | ] 253 | 254 | [[package]] 255 | name = "hmac" 256 | version = "0.7.1" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | dependencies = [ 259 | "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 260 | "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 261 | ] 262 | 263 | [[package]] 264 | name = "iovec" 265 | version = "0.1.4" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | dependencies = [ 268 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 269 | ] 270 | 271 | [[package]] 272 | name = "itoa" 273 | version = "0.4.4" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | 276 | [[package]] 277 | name = "kernel32-sys" 278 | version = "0.2.2" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | dependencies = [ 281 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 282 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 283 | ] 284 | 285 | [[package]] 286 | name = "lazy_static" 287 | version = "1.4.0" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | 290 | [[package]] 291 | name = "libc" 292 | version = "0.2.65" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | 295 | [[package]] 296 | name = "lock_api" 297 | version = "0.3.1" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | dependencies = [ 300 | "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 301 | ] 302 | 303 | [[package]] 304 | name = "log" 305 | version = "0.4.8" 306 | source = "registry+https://github.com/rust-lang/crates.io-index" 307 | dependencies = [ 308 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 309 | ] 310 | 311 | [[package]] 312 | name = "matches" 313 | version = "0.1.8" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | 316 | [[package]] 317 | name = "md5" 318 | version = "0.7.0" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | 321 | [[package]] 322 | name = "memchr" 323 | version = "2.2.1" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | 326 | [[package]] 327 | name = "mio" 328 | version = "0.6.21" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | dependencies = [ 331 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 332 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 333 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 334 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 335 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 336 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 337 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 338 | "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 339 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 340 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 341 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 342 | ] 343 | 344 | [[package]] 345 | name = "mio-uds" 346 | version = "0.6.7" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | dependencies = [ 349 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 350 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 351 | "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", 352 | ] 353 | 354 | [[package]] 355 | name = "miow" 356 | version = "0.2.1" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | dependencies = [ 359 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 360 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 361 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 362 | "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 363 | ] 364 | 365 | [[package]] 366 | name = "net2" 367 | version = "0.2.33" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | dependencies = [ 370 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 371 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 372 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 373 | ] 374 | 375 | [[package]] 376 | name = "num-integer" 377 | version = "0.1.41" 378 | source = "registry+https://github.com/rust-lang/crates.io-index" 379 | dependencies = [ 380 | "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 381 | "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 382 | ] 383 | 384 | [[package]] 385 | name = "num-traits" 386 | version = "0.2.8" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | dependencies = [ 389 | "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 390 | ] 391 | 392 | [[package]] 393 | name = "opaque-debug" 394 | version = "0.2.3" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | 397 | [[package]] 398 | name = "parking_lot" 399 | version = "0.10.0" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | dependencies = [ 402 | "lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 403 | "parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 404 | ] 405 | 406 | [[package]] 407 | name = "parking_lot_core" 408 | version = "0.7.0" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | dependencies = [ 411 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 412 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 413 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 414 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 415 | "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 416 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 417 | ] 418 | 419 | [[package]] 420 | name = "percent-encoding" 421 | version = "2.1.0" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | 424 | [[package]] 425 | name = "phf" 426 | version = "0.8.0" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | dependencies = [ 429 | "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 430 | ] 431 | 432 | [[package]] 433 | name = "phf_shared" 434 | version = "0.8.0" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | dependencies = [ 437 | "siphasher 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 438 | ] 439 | 440 | [[package]] 441 | name = "pin-project-lite" 442 | version = "0.1.2" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | 445 | [[package]] 446 | name = "pin-utils" 447 | version = "0.1.0-alpha.4" 448 | source = "registry+https://github.com/rust-lang/crates.io-index" 449 | 450 | [[package]] 451 | name = "postgres-protocol" 452 | version = "0.5.0" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | dependencies = [ 455 | "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 456 | "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 457 | "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 458 | "fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 459 | "generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", 460 | "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 461 | "md5 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 462 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 463 | "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", 464 | "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 465 | "stringprep 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 466 | ] 467 | 468 | [[package]] 469 | name = "postgres-types" 470 | version = "0.1.0" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | dependencies = [ 473 | "bit-vec 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 474 | "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 475 | "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", 476 | "eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 477 | "fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 478 | "geo-types 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", 479 | "postgres-protocol 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 480 | "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", 481 | "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", 482 | "uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 483 | ] 484 | 485 | [[package]] 486 | name = "ppv-lite86" 487 | version = "0.2.6" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | 490 | [[package]] 491 | name = "proc-macro-hack" 492 | version = "0.5.11" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | dependencies = [ 495 | "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 496 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 497 | "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 498 | ] 499 | 500 | [[package]] 501 | name = "proc-macro-nested" 502 | version = "0.1.3" 503 | source = "registry+https://github.com/rust-lang/crates.io-index" 504 | 505 | [[package]] 506 | name = "proc-macro2" 507 | version = "1.0.5" 508 | source = "registry+https://github.com/rust-lang/crates.io-index" 509 | dependencies = [ 510 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 511 | ] 512 | 513 | [[package]] 514 | name = "quote" 515 | version = "1.0.2" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | dependencies = [ 518 | "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 519 | ] 520 | 521 | [[package]] 522 | name = "rand" 523 | version = "0.7.2" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | dependencies = [ 526 | "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", 527 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 528 | "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 529 | "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 530 | "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 531 | ] 532 | 533 | [[package]] 534 | name = "rand_chacha" 535 | version = "0.2.1" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | dependencies = [ 538 | "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 539 | "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 540 | ] 541 | 542 | [[package]] 543 | name = "rand_core" 544 | version = "0.5.1" 545 | source = "registry+https://github.com/rust-lang/crates.io-index" 546 | dependencies = [ 547 | "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", 548 | ] 549 | 550 | [[package]] 551 | name = "rand_hc" 552 | version = "0.2.0" 553 | source = "registry+https://github.com/rust-lang/crates.io-index" 554 | dependencies = [ 555 | "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 556 | ] 557 | 558 | [[package]] 559 | name = "redox_syscall" 560 | version = "0.1.56" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | 563 | [[package]] 564 | name = "rustc-serialize" 565 | version = "0.3.24" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | 568 | [[package]] 569 | name = "ryu" 570 | version = "1.0.2" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | 573 | [[package]] 574 | name = "scopeguard" 575 | version = "1.0.0" 576 | source = "registry+https://github.com/rust-lang/crates.io-index" 577 | 578 | [[package]] 579 | name = "serde" 580 | version = "1.0.101" 581 | source = "registry+https://github.com/rust-lang/crates.io-index" 582 | 583 | [[package]] 584 | name = "serde_json" 585 | version = "1.0.41" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | dependencies = [ 588 | "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 589 | "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 590 | "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", 591 | ] 592 | 593 | [[package]] 594 | name = "sha2" 595 | version = "0.8.0" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | dependencies = [ 598 | "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", 599 | "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 600 | "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 601 | "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 602 | ] 603 | 604 | [[package]] 605 | name = "siphasher" 606 | version = "0.3.1" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | 609 | [[package]] 610 | name = "slab" 611 | version = "0.4.2" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | 614 | [[package]] 615 | name = "smallvec" 616 | version = "0.6.10" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | 619 | [[package]] 620 | name = "smallvec" 621 | version = "1.1.0" 622 | source = "registry+https://github.com/rust-lang/crates.io-index" 623 | 624 | [[package]] 625 | name = "sprattus" 626 | version = "0.0.1" 627 | dependencies = [ 628 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 629 | "sprattus-derive 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 630 | "strfmt 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 631 | "tokio 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 632 | "tokio-postgres 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 633 | ] 634 | 635 | [[package]] 636 | name = "sprattus-derive" 637 | version = "0.0.1" 638 | dependencies = [ 639 | "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 640 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 641 | "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 642 | ] 643 | 644 | [[package]] 645 | name = "sprattus-derive" 646 | version = "0.0.1" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | dependencies = [ 649 | "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 650 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 651 | "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 652 | ] 653 | 654 | [[package]] 655 | name = "sprattus-test" 656 | version = "0.1.0" 657 | dependencies = [ 658 | "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", 659 | "sprattus 0.0.1", 660 | "tokio 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 661 | ] 662 | 663 | [[package]] 664 | name = "strfmt" 665 | version = "0.1.6" 666 | source = "registry+https://github.com/rust-lang/crates.io-index" 667 | 668 | [[package]] 669 | name = "stringprep" 670 | version = "0.1.2" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | dependencies = [ 673 | "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 674 | "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 675 | ] 676 | 677 | [[package]] 678 | name = "subtle" 679 | version = "1.0.0" 680 | source = "registry+https://github.com/rust-lang/crates.io-index" 681 | 682 | [[package]] 683 | name = "syn" 684 | version = "1.0.5" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | dependencies = [ 687 | "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 688 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 689 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 690 | ] 691 | 692 | [[package]] 693 | name = "time" 694 | version = "0.1.42" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | dependencies = [ 697 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 698 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 699 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 700 | ] 701 | 702 | [[package]] 703 | name = "tokio" 704 | version = "0.2.8" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | dependencies = [ 707 | "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 708 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 709 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 710 | "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", 711 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 712 | "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", 713 | "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 714 | "pin-project-lite 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 715 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 716 | "tokio-macros 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 717 | ] 718 | 719 | [[package]] 720 | name = "tokio-macros" 721 | version = "0.2.3" 722 | source = "registry+https://github.com/rust-lang/crates.io-index" 723 | dependencies = [ 724 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 725 | "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 726 | ] 727 | 728 | [[package]] 729 | name = "tokio-postgres" 730 | version = "0.5.1" 731 | source = "registry+https://github.com/rust-lang/crates.io-index" 732 | dependencies = [ 733 | "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 734 | "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 735 | "fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 736 | "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 737 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 738 | "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 739 | "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 740 | "phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 741 | "pin-project-lite 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 742 | "postgres-protocol 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 743 | "postgres-types 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 744 | "tokio 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 745 | "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 746 | ] 747 | 748 | [[package]] 749 | name = "tokio-util" 750 | version = "0.2.0" 751 | source = "registry+https://github.com/rust-lang/crates.io-index" 752 | dependencies = [ 753 | "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 754 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 755 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 756 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 757 | "pin-project-lite 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 758 | "tokio 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 759 | ] 760 | 761 | [[package]] 762 | name = "typenum" 763 | version = "1.11.2" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | 766 | [[package]] 767 | name = "unicode-bidi" 768 | version = "0.3.4" 769 | source = "registry+https://github.com/rust-lang/crates.io-index" 770 | dependencies = [ 771 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 772 | ] 773 | 774 | [[package]] 775 | name = "unicode-normalization" 776 | version = "0.1.8" 777 | source = "registry+https://github.com/rust-lang/crates.io-index" 778 | dependencies = [ 779 | "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 780 | ] 781 | 782 | [[package]] 783 | name = "unicode-xid" 784 | version = "0.2.0" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | 787 | [[package]] 788 | name = "uuid" 789 | version = "0.8.1" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | 792 | [[package]] 793 | name = "wasi" 794 | version = "0.9.0+wasi-snapshot-preview1" 795 | source = "registry+https://github.com/rust-lang/crates.io-index" 796 | 797 | [[package]] 798 | name = "winapi" 799 | version = "0.2.8" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | 802 | [[package]] 803 | name = "winapi" 804 | version = "0.3.8" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | dependencies = [ 807 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 808 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 809 | ] 810 | 811 | [[package]] 812 | name = "winapi-build" 813 | version = "0.1.1" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | 816 | [[package]] 817 | name = "winapi-i686-pc-windows-gnu" 818 | version = "0.4.0" 819 | source = "registry+https://github.com/rust-lang/crates.io-index" 820 | 821 | [[package]] 822 | name = "winapi-x86_64-pc-windows-gnu" 823 | version = "0.4.0" 824 | source = "registry+https://github.com/rust-lang/crates.io-index" 825 | 826 | [[package]] 827 | name = "ws2_32-sys" 828 | version = "0.2.1" 829 | source = "registry+https://github.com/rust-lang/crates.io-index" 830 | dependencies = [ 831 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 832 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 833 | ] 834 | 835 | [metadata] 836 | "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" 837 | "checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" 838 | "checksum bit-vec 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a4523a10839ffae575fb08aa3423026c8cb4687eef43952afb956229d4f246f7" 839 | "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 840 | "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" 841 | "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" 842 | "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" 843 | "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" 844 | "checksum bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38" 845 | "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" 846 | "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 847 | "checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68" 848 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 849 | "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" 850 | "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" 851 | "checksum eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8c4cf866e4d3e5e773691f5f61615a224a7b0b72b7daf994fc56d1b82dab0b6b" 852 | "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" 853 | "checksum fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 854 | "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 855 | "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 856 | "checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" 857 | "checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" 858 | "checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" 859 | "checksum futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" 860 | "checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" 861 | "checksum futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" 862 | "checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" 863 | "checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" 864 | "checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" 865 | "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" 866 | "checksum generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd" 867 | "checksum geo-types 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "866e8f6dbd2218b05ea8a25daa1bfac32b0515fe7e0a37cb6a7b9ed0ed82a07e" 868 | "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" 869 | "checksum hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" 870 | "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" 871 | "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" 872 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 873 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 874 | "checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" 875 | "checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" 876 | "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" 877 | "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 878 | "checksum md5 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" 879 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" 880 | "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" 881 | "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" 882 | "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 883 | "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" 884 | "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" 885 | "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" 886 | "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" 887 | "checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" 888 | "checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" 889 | "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 890 | "checksum phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" 891 | "checksum phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" 892 | "checksum pin-project-lite 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e8822eb8bb72452f038ebf6048efa02c3fe22bf83f76519c9583e47fc194a422" 893 | "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" 894 | "checksum postgres-protocol 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a30f0e172ae0fb0653dbf777ad10a74b8e58d6de95a892f2e1d3e94a9df9a844" 895 | "checksum postgres-types 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eab1dd99401779ab03bc3872f196fb02c420e76f416c850be494a6f2d67287ad" 896 | "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" 897 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" 898 | "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" 899 | "checksum proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0" 900 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" 901 | "checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" 902 | "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" 903 | "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 904 | "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 905 | "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 906 | "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" 907 | "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" 908 | "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" 909 | "checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd" 910 | "checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" 911 | "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" 912 | "checksum siphasher 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "83da420ee8d1a89e640d0948c646c1c088758d3a3c538f943bfa97bdac17929d" 913 | "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 914 | "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" 915 | "checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" 916 | "checksum sprattus-derive 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87b085348ff66129a9373584ec18621a00f12ac73afbed85f3eb49a94aecdf4e" 917 | "checksum strfmt 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b278b244ef7aa5852b277f52dd0c6cac3a109919e1f6d699adde63251227a30f" 918 | "checksum stringprep 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" 919 | "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" 920 | "checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" 921 | "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" 922 | "checksum tokio 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "a9d5acfe1b1130d50ac2286a2f1f8cf49309680366ceb7609ce369b75c9058d4" 923 | "checksum tokio-macros 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "50a61f268a3db2acee8dcab514efc813dc6dbe8a00e86076f935f94304b59a7a" 924 | "checksum tokio-postgres 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c03cb0c66092269a9b280e9e4956cb23ce00b8a6b1b393f7700f7732ac4bf133" 925 | "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" 926 | "checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" 927 | "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 928 | "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" 929 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" 930 | "checksum uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" 931 | "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 932 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 933 | "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" 934 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 935 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 936 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 937 | "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 938 | --------------------------------------------------------------------------------