From 6759d5ba7acf0f0b76c7810c80b945afdd2dd061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=8C=E6=88=88?= Date: Fri, 25 Oct 2019 17:13:40 +0800 Subject: [PATCH 1/2] Add NaiveDateTime -> Value conversion --- crates/dao/src/value.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/dao/src/value.rs b/crates/dao/src/value.rs index 3ac078c..3850a8b 100644 --- a/crates/dao/src/value.rs +++ b/crates/dao/src/value.rs @@ -3,7 +3,10 @@ use crate::{ interval::Interval, ConvertError, }; -use bigdecimal::{BigDecimal, ToPrimitive}; +use bigdecimal::{ + BigDecimal, + ToPrimitive, +}; use chrono::{ DateTime, NaiveDate, @@ -169,6 +172,7 @@ impl_from!(Uuid, Uuid); impl_from!(NaiveDate, Date); impl_from!(NaiveTime, Time); impl_from!(DateTime, Timestamp); +impl_from!(NaiveDateTime, DateTime); impl<'a> From<&'a str> for Value { fn from(f: &'a str) -> Value { Value::Text(f.to_string()) } @@ -265,7 +269,7 @@ impl<'a> TryFrom<&'a Value> for String { String::from_utf8(v.to_owned()).map_err(|e| { ConvertError::NotSupported(format!("{:?}", value), format!("String: {}", e)) }) - }, + } _ => { Err(ConvertError::NotSupported( format!("{:?}", value), From b9fd20ea63d99c01c5db57ca591ad208d27de5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=8C=E6=88=88?= Date: Fri, 25 Oct 2019 18:02:44 +0800 Subject: [PATCH 2/2] Use local dao and codegen dependency --- Cargo.toml | 10 ++-------- src/table.rs | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6ae0b7a..0cc9cc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,8 +38,8 @@ tree_magic = "0.2" base64 = "0.9" geo = "0.4" time = "0.1.14" -rustorm_dao = "0.4.0" -rustorm_codegen = "0.3.0" +rustorm_dao = { path = "crates/dao" } +rustorm_codegen = { path = "crates/codegen" } r2d2_mysql = {version = "16.0.0", optional = true} thiserror = "1.0.3" @@ -54,9 +54,3 @@ with-postgres = ["postgres", "r2d2_postgres", "postgres-shared"] with-sqlite = ["rusqlite","r2d2_sqlite"] with-mysql = ["r2d2_mysql"] - -# Needed to be here since rustorm is tested as one project -# in the ci instead of part of diwata -[replace] -"rustorm_dao:0.4.0" = { path = "crates/dao" } -"rustorm_codegen:0.3.0" = { path = "crates/codegen" } diff --git a/src/table.rs b/src/table.rs index e0ed327..ddbb8a6 100644 --- a/src/table.rs +++ b/src/table.rs @@ -167,9 +167,9 @@ impl Table { /// if the table in context is product and the foreign table is category /// ForeignKey{ /// name: product_category_fkey -/// columns: [category_id] +/// columns: _category_id_ /// foreign_table: category -/// referred_columns: [id] +/// referred_columns: _id_ /// } #[derive(Debug, PartialEq, Clone)] pub struct ForeignKey {