Labels
good first issueGood for newcomersGood for newcomers
Description
We would like to rewrite SeaORM tutorial and align with SeaORM 0.8.0 and beyond.
We're going to have two types of tutorial:
- The Basics of SeaORM: covers all essentials of SeaORM, including db setup and connection, db migration, generating entity files, CRUD operations, relational selects and mock testing
- Integrating with SeaORM: showcase how to integrate SeaORM with other framework, including but not limited to Rocket, Actix, Async GraphQL
To make the tutorial more realistic and interesting, we could have theme across our tutorial.
- For example, a chain bakery shop?
The Basics of SeaORM
Table of Content
- Setting up the database: one of MySQL, PostgreSQL, SQLite
- Creating a Cargo workspace for the SeaORM project
- Writing database migration and applying it
- Generating entity files with
sea-orm-cli - Performing CRUD operations
- Selecting related models
- Writing tests with mock interface
Integrating with SeaORM
This would be split into multiple tutorials that depend on prior knowledge of "The Basics of SeaORM".
Frameworks to be included
- Rocket, Actix, Axum...etc (common Web API frameworks): The application could have interfaces for updating the product catalog of bakery shop, or even a point of sales system.
- gRPC, GraphQL (API endpoint): A API for accessing product catalog or sales data via a specific API.
Your comments, suggestions and feedbacks are appreciated!
Please leave a comment below and let us know your thoughts :)
CC @tyt2y3
Reacted by Nahua and Matthew Aylward
Metadata
Metadata
Labels
good first issueGood for newcomersGood for newcomers
Type
Projects
- StatusShow more project fieldsTriage
Activity
nahuakang commentedon May 25, 2022
I'd be happy to help work out the new tutorials as much as time allows 🥳
One general question:
Two specific questions:
warpet al. later on, after the entire tutorial is published.From my part, I've not worked with gRPC or GraphQL yet. Could use support there.
billy1624 commentedon May 26, 2022
Hey @nahuakang,
wrapin the integration tutorial. But yeah, we can focus on first part of the tutorialLet me know your thoughts :)
billy1624 commentedon May 31, 2022
Hey @nahuakang, @shpun817 and I will take on this task :)
shpun817 commentedon May 31, 2022
Proposed outline of the revamped tutorial:
SeaORM Tutorials
Introduction
Chapter 1 - Building a Backend with SeaORM
Chapter 2 - Integration with Rocket
Chapter 3 - Integration with GraphQL
Revamp SeaORM Tutorials (Issue #8) (#9)
billy1624 commentedon Jun 27, 2022
We still have chapter 3 and more
billy1624 commentedon Jul 18, 2022
More tutorials are welcomed! e.g. advanced topics in SeaORM, step-by-step integration example for SeaORM with frameworks such as gRPC, etc.
nahuakang commentedon Jul 18, 2022
The new tutorial looks amazing 🥇 (sorry I didn't help out at all). I'll read it as soon as I can and give feedback from the view of a new user :)
billy1624 commentedon Jul 19, 2022
Hey @nahuakang, no worries! Please let us know your thoughts on the new SeaORM tutorials :)
nahuakang commentedon Jul 19, 2022
I left some edits on Chapter 1: #18. Overall this chapter gave a very smooth introduction to how to link up
sea-ormwith a cargo project and is a significant upgrade for me.https://www.sea-ql.org/sea-orm-tutorial/ch01-08-sql-with-sea-query.html is perhaps the most confusing to me. Some lines, such as
Invoke values_panic() for each row, seem confusing to me and I struggle to see the benefits of usingSeaQueryover raw SQL orSeaORM. Maybe we could add some paragraphs on why and whenSeaQuerywill shine?Edit: I think
sea-queryREADME emphasizes the advantage ofSeaQueryvery well so maybe a few sentences copied from the README would work already 😄billy1624 commentedon Jul 25, 2022
I think using SeaQuery to construct query statement while executing it on SeaORM gives you flexibility over the query building while ease the difficulty of managing the connection and mapping query result into struct.
timuchen commentedon Jun 7, 2024
Hello! I think you should pay attention to how Relational Query works.
https://www.sea-ql.org/sea-orm-tutorial/ch03-02-query.html
// src/schema.rs
// src/entities/bakery.rs
I get:
Inherent
implcannot be defined for a type outside its containing crate [E0116]Obviously, it is necessary to describe a different approach, since we want to move the GraphQl logic to another crate.
When we add a ComplexObject directly to an Entity, we lose context.
billy1624 commentedon Jun 27, 2024
Interesting. If you look at the full source code (https://www.sea-ql.org/sea-orm-tutorial/ch03-00-integration-with-graphql.html) The
implis actually on reside in the same crate where the entity is defined.