Added ColumnType::Blob
(#2213)
* Added `ColumnType::Blob` * Fix * Fix * Use latest rc versions * bump sea-query & sea-schema * fix loco examples * fix loco examples * revert
This commit is contained in:
parent
33f4659db7
commit
36a151bba7
@ -34,8 +34,8 @@ tracing = { version = "0.1", default-features = false, features = ["attributes",
|
||||
rust_decimal = { version = "1", default-features = false, optional = true }
|
||||
bigdecimal = { version = "0.3", default-features = false, optional = true }
|
||||
sea-orm-macros = { version = "1.0.0-rc.3", path = "sea-orm-macros", default-features = false, features = ["strum"] }
|
||||
sea-query = { version = "0.31.0-rc.5", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] }
|
||||
sea-query-binder = { version = "0.6.0-rc.2", default-features = false, optional = true }
|
||||
sea-query = { version = "0.31.0-rc", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] }
|
||||
sea-query-binder = { version = "0.6.0-rc", default-features = false, optional = true }
|
||||
strum = { version = "0.26", default-features = false }
|
||||
serde = { version = "1.0", default-features = false }
|
||||
serde_json = { version = "1.0", default-features = false, optional = true }
|
||||
|
1407
examples/loco_example/Cargo.lock
generated
1407
examples/loco_example/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
loco-rs = { version = "0.2" }
|
||||
loco-rs = { version = "0.4" }
|
||||
migration = { path = "migration" }
|
||||
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
@ -26,7 +26,7 @@ uuid = { version = "1.6.0", features = ["v4"] }
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }
|
||||
|
||||
[dependencies.sea-orm]
|
||||
# path = "../../" # remove this line in your own project
|
||||
path = "../../" # remove this line in your own project
|
||||
version = "1.0.0-rc.3" # sea-orm version
|
||||
features = [
|
||||
"sqlx-sqlite",
|
||||
@ -43,7 +43,7 @@ required-features = []
|
||||
[dev-dependencies]
|
||||
serial_test = "2.0.0"
|
||||
rstest = "0.18.2"
|
||||
loco-rs = { version = "0.2", features = ["testing"] }
|
||||
loco-rs = { version = "0.4", features = ["testing"] }
|
||||
insta = { version = "1.34.0", features = ["redactions", "yaml", "filters"] }
|
||||
|
||||
# This allows us to develop using a local version of sea-orm
|
||||
@ -51,4 +51,3 @@ insta = { version = "1.34.0", features = ["redactions", "yaml", "filters"] }
|
||||
[patch.crates-io]
|
||||
sea-orm = { path = "../../" }
|
||||
sea-orm-migration = { path = "../../sea-orm-migration" }
|
||||
loco-rs = { git = "https://github.com/billy1624/loco", branch = "sea-orm-v1.0" }
|
||||
|
@ -10,10 +10,10 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
||||
loco-rs = { version = "0.2" }
|
||||
loco-rs = { version = "0.4" }
|
||||
|
||||
[dependencies.sea-orm-migration]
|
||||
# path = "../../../sea-orm-migration" # remove this line in your own project
|
||||
path = "../../../sea-orm-migration" # remove this line in your own project
|
||||
version = "1.0.0-rc.3" # sea-orm-migration version
|
||||
features = [
|
||||
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
|
||||
|
@ -24,11 +24,11 @@ async fn load_item(ctx: &AppContext, id: i32) -> Result<Model> {
|
||||
item.ok_or_else(|| Error::NotFound)
|
||||
}
|
||||
|
||||
pub async fn list(State(ctx): State<AppContext>) -> Result<Json<Vec<Model>>> {
|
||||
pub async fn list(State(ctx): State<AppContext>) -> Result<Response> {
|
||||
format::json(Entity::find().all(&ctx.db).await?)
|
||||
}
|
||||
|
||||
pub async fn add(State(ctx): State<AppContext>, Json(params): Json<Params>) -> Result<Json<Model>> {
|
||||
pub async fn add(State(ctx): State<AppContext>, Json(params): Json<Params>) -> Result<Response> {
|
||||
let mut item = ActiveModel {
|
||||
..Default::default()
|
||||
};
|
||||
@ -41,7 +41,7 @@ pub async fn update(
|
||||
Path(id): Path<i32>,
|
||||
State(ctx): State<AppContext>,
|
||||
Json(params): Json<Params>,
|
||||
) -> Result<Json<Model>> {
|
||||
) -> Result<Response> {
|
||||
let item = load_item(&ctx, id).await?;
|
||||
let mut item = item.into_active_model();
|
||||
params.update(&mut item);
|
||||
@ -49,12 +49,12 @@ pub async fn update(
|
||||
format::json(item)
|
||||
}
|
||||
|
||||
pub async fn remove(Path(id): Path<i32>, State(ctx): State<AppContext>) -> Result<()> {
|
||||
pub async fn remove(Path(id): Path<i32>, State(ctx): State<AppContext>) -> Result<Response> {
|
||||
load_item(&ctx, id).await?.delete(&ctx.db).await?;
|
||||
format::empty()
|
||||
}
|
||||
|
||||
pub async fn get_one(Path(id): Path<i32>, State(ctx): State<AppContext>) -> Result<Json<Model>> {
|
||||
pub async fn get_one(Path(id): Path<i32>, State(ctx): State<AppContext>) -> Result<Response> {
|
||||
format::json(load_item(&ctx, id).await?)
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ clap = { version = "4.3", features = ["env", "derive"], optional = true }
|
||||
dotenvy = { version = "0.15", default-features = false, optional = true }
|
||||
async-std = { version = "1.9", default-features = false, features = ["attributes", "tokio1"], optional = true }
|
||||
sea-orm-codegen = { version = "=1.0.0-rc.3", path = "../sea-orm-codegen", default-features = false, optional = true }
|
||||
sea-schema = { version = "0.15.0-rc.5" }
|
||||
sea-schema = { version = "0.15.0-rc" }
|
||||
sqlx = { version = "0.7", default-features = false, features = ["mysql", "postgres"], optional = true }
|
||||
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] }
|
||||
tracing = { version = "0.1", default-features = false }
|
||||
|
@ -17,7 +17,7 @@ name = "sea_orm_codegen"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
sea-query = { version = "0.31.0-rc.3", default-features = false, features = ["thread-safe"] }
|
||||
sea-query = { version = "0.31.0-rc", default-features = false, features = ["thread-safe"] }
|
||||
syn = { version = "2", default-features = false, features = ["parsing", "proc-macro", "derive", "printing"] }
|
||||
quote = { version = "1", default-features = false }
|
||||
heck = { version = "0.4", default-features = false }
|
||||
|
@ -69,7 +69,9 @@ impl Column {
|
||||
},
|
||||
ColumnType::Decimal(_) | ColumnType::Money(_) => "Decimal".to_owned(),
|
||||
ColumnType::Uuid => "Uuid".to_owned(),
|
||||
ColumnType::Binary(_) | ColumnType::VarBinary(_) => "Vec<u8>".to_owned(),
|
||||
ColumnType::Binary(_) | ColumnType::VarBinary(_) | ColumnType::Blob => {
|
||||
"Vec<u8>".to_owned()
|
||||
}
|
||||
ColumnType::Boolean => "bool".to_owned(),
|
||||
ColumnType::Enum { name, .. } => name.to_string().to_upper_camel_case(),
|
||||
ColumnType::Array(column_type) => {
|
||||
@ -102,6 +104,7 @@ impl Column {
|
||||
StringLen::None => Some("VarBinary(StringLen::None)".to_owned()),
|
||||
StringLen::Max => Some("VarBinary(StringLen::Max)".to_owned()),
|
||||
},
|
||||
ColumnType::Blob => Some("Blob".to_owned()),
|
||||
_ => None,
|
||||
};
|
||||
col_type.map(|ty| quote! { column_type = #ty })
|
||||
@ -149,6 +152,7 @@ impl Column {
|
||||
StringLen::None => quote! { ColumnType::VarBinary(StringLen::None) },
|
||||
StringLen::Max => quote! { ColumnType::VarBinary(StringLen::Max) },
|
||||
},
|
||||
ColumnType::Blob => quote! { ColumnType::Blob },
|
||||
ColumnType::Boolean => quote! { ColumnType::Boolean },
|
||||
ColumnType::Money(s) => match s {
|
||||
Some((s1, s2)) => quote! { ColumnType::Money(Some((#s1, #s2))) },
|
||||
|
@ -25,7 +25,7 @@ clap = { version = "4.3", features = ["env", "derive"], optional = true }
|
||||
dotenvy = { version = "0.15", default-features = false, optional = true }
|
||||
sea-orm = { version = "1.0.0-rc.3", path = "../", default-features = false, features = ["macros"] }
|
||||
sea-orm-cli = { version = "1.0.0-rc.3", path = "../sea-orm-cli", default-features = false, optional = true }
|
||||
sea-schema = { version = "0.15.0-rc.5" }
|
||||
sea-schema = { version = "0.15.0-rc" }
|
||||
tracing = { version = "0.1", default-features = false, features = ["log"] }
|
||||
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] }
|
||||
futures = { version = "0.3", default-features = false, features = ["std"] }
|
||||
|
Loading…
x
Reference in New Issue
Block a user