Merge pull request #320 from SeaQL/issues/319
`with-json` feature requires `chrono/serde`
This commit is contained in:
commit
f2a774573a
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
@ -314,7 +314,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
path: [86, 249, 262]
|
path: [86, 249, 262, 319]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ default = [
|
|||||||
]
|
]
|
||||||
macros = ["sea-orm-macros"]
|
macros = ["sea-orm-macros"]
|
||||||
mock = []
|
mock = []
|
||||||
with-json = ["serde_json", "sea-query/with-json"]
|
with-json = ["serde_json", "sea-query/with-json", "chrono/serde"]
|
||||||
with-chrono = ["chrono", "sea-query/with-chrono"]
|
with-chrono = ["chrono", "sea-query/with-chrono"]
|
||||||
with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal"]
|
with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal"]
|
||||||
with-uuid = ["uuid", "sea-query/with-uuid"]
|
with-uuid = ["uuid", "sea-query/with-uuid"]
|
||||||
|
18
issues/319/Cargo.toml
Normal file
18
issues/319/Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[workspace]
|
||||||
|
# A separate workspace
|
||||||
|
|
||||||
|
[package]
|
||||||
|
name = "sea-orm-issues-319"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
async-std = { version = "^1", features = ["attributes"] }
|
||||||
|
serde = { version = "^1", features = ["derive"] }
|
||||||
|
sea-orm = { path = "../../", features = [
|
||||||
|
"sqlx-mysql",
|
||||||
|
"runtime-async-std-native-tls",
|
||||||
|
"with-json",
|
||||||
|
"macros",
|
||||||
|
], default-features = false }
|
14
issues/319/src/main.rs
Normal file
14
issues/319/src/main.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
mod material;
|
||||||
|
use sea_orm::*;
|
||||||
|
|
||||||
|
#[async_std::main]
|
||||||
|
pub async fn main() {
|
||||||
|
let db = Database::connect("mysql://sea:sea@localhost/bakery")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
async_std::task::spawn(async move {
|
||||||
|
material::Entity::find().one(&db).await.unwrap();
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
}
|
20
issues/319/src/material.rs
Normal file
20
issues/319/src/material.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
use sea_orm::entity::prelude::*;
|
||||||
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||||
|
#[sea_orm(table_name = "materials")]
|
||||||
|
pub struct Model {
|
||||||
|
#[sea_orm(primary_key)]
|
||||||
|
pub id: i32,
|
||||||
|
pub created_at: DateTimeWithTimeZone,
|
||||||
|
pub updated_at: DateTimeWithTimeZone,
|
||||||
|
pub name: String,
|
||||||
|
#[sea_orm(column_type = "Text", nullable)]
|
||||||
|
pub description: Option<String>,
|
||||||
|
pub tag_ids: Vec<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
pub enum Relation {}
|
||||||
|
|
||||||
|
impl ActiveModelBehavior for ActiveModel {}
|
Loading…
x
Reference in New Issue
Block a user