-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Revamped outline * Rewrite introduction * Remove old tutorials * Draft ch01-00 * Draft ch01-01 * Edit SQLite (in file) example URL * Add bakery-backend source code * Add `sea-orm-migration` dependency * Create migrator module * Create migrations * Use Migrator to define the database schema * Draft ch01-02 * Draft ch01-03 * Draft ch01-04 * Insert and update * Find (single entity) * Delete * Draft ch01-06 * Draft ch01-07 * Remove PostgreSQL prompt symbol guide * Add reminder of executing sea-orm-cli at the project root * Specify file path of Cargo.toml * intro: "the most" -> "a" * Remove legacy example source files * Draft ch01-08 * Add SeaQuery usage source code * Add Rocket integration example source code * Update SUMMARY * Section rename: "Fetch from Database" -> "Connect to Database" * Draft ch02-00 * Remove # in SUMMARY.md * Add `/reset` endpoint in Rocket integration example source code * Draft ch02-01 * Add templates to provide a minimal frontend * Remove non-existent handler in ch02-01 * Draft ch02-02 * Add section for simple frontend using templates in plan * Draft ch02-03 * Add mounting new endpoint handler in ch02-02 * Draft ch02-04 * Draft ch02-05 * Merge Billy's changes * Update ch01-00-simple-crud-getting-started.md (#10) Missing features "attributes" for async-std. Thank you! * Remove old tutorial section ch01-00-simple-crud-getting-started.md * Update GitHub workflows for building the examples * Update README.md * Prepare for early release (postponing the release of chapter 3) Co-authored-by: Nicolas Carranza <[email protected]>
- Loading branch information
Showing
105 changed files
with
3,391 additions
and
3,949 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[workspace] | ||
members = ["bakery-backend", "rocket-example"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "bakery-backend" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
futures = "0.3.21" | ||
sea-orm = { version = "0.8.0", features = [ "sqlx-mysql", "runtime-async-std-native-tls", "macros", "mock" ] } | ||
sea-orm-migration = "0.8.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.8.0 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "baker")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i32, | ||
pub name: String, | ||
pub contact_details: Option<Json>, | ||
pub bakery_id: i32, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::bakery::Entity", | ||
from = "Column::BakeryId", | ||
to = "super::bakery::Column::Id", | ||
on_update = "NoAction", | ||
on_delete = "NoAction" | ||
)] | ||
Bakery, | ||
} | ||
|
||
impl Related<super::bakery::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Bakery.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.8.0 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "bakery")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i32, | ||
pub name: String, | ||
pub profit_margin: f64, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm(has_many = "super::baker::Entity")] | ||
Baker, | ||
} | ||
|
||
impl Related<super::baker::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Baker.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.8.0 | ||
pub mod prelude; | ||
|
||
pub mod baker; | ||
pub mod bakery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.8.0 | ||
pub use super::baker::Entity as Baker; | ||
pub use super::bakery::Entity as Bakery; |
Oops, something went wrong.