Test [issues]

This commit is contained in:
Billy Chan 2021-11-15 21:27:54 +08:00
parent 63c764d6a4
commit 1c4fc11efe
No known key found for this signature in database
GPG Key ID: A2D690CAC7DF3CC7
3 changed files with 52 additions and 0 deletions

18
issues/319/Cargo.toml Normal file
View 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
View 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;
}

View 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 {}