Skip to content

Commit

Permalink
cleanup (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
romaninsh authored Nov 28, 2024
1 parent a7439e2 commit 6ed1f77
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 285 deletions.
5 changes: 0 additions & 5 deletions bakery_model/examples/2-joined-tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ async fn create_bootstrap_db() -> Result<()> {
Ok(())
}

#[tokio::test]
async fn test_abc() {
panic!("aoeu");
}

#[tokio::main]
async fn main() -> Result<()> {
create_bootstrap_db().await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,12 @@ let condition = column.eq(&"John")
let condition = expr!("now()").lt(&yesterday)
```

####################################################################
Conditions created by the operation can be used in `with_condition()` method.

---
## Conclusion

####################################################################
In DORM - expressions and operations create a powerful way to extend of high-level `Table` features
such as conditions and expression fields.

Using `with_` is more readable and does not require you to define
`users` as mutable.

There is also a `with` method if you want to define table inside a closure.

```rust
let users = Table::new("users", postgres())
.with(|t| {
t.add_column("id");
t.add_id_column("name");
t.add_title_column("role_name");
t.add_condition(t.get_column("name").unwrap().eq("John"));
});
```

In the later chapters I'll explain to you how to use this properly.
Functionality is composable of underlying components. If `Table` does not implement a feature you
like, you can easily build it using Expressions and Operations.
103 changes: 0 additions & 103 deletions docs/src/3-fields-and-operations.md

This file was deleted.

48 changes: 0 additions & 48 deletions docs/src/4-conditions.md

This file was deleted.

106 changes: 0 additions & 106 deletions docs/src/5-entity-model.md

This file was deleted.

5 changes: 1 addition & 4 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
- [Tables](./1a-table.md)
- [Table Columns](./1b-table-columns.md)
- [Expressions and Queries](./2-expressions-and-queries.md)
- [Expressions in table](./2a-expressions-in-table.md)
- [References](./2-references.md)
- [Fields and Operations](./3-fields-and-operations.md)
- [Conditions](./4-conditions.md)
- [Entity Model](./5-entity-model.md)
- [Expressions in table](./3-expressions-in-table.md)
- [Joins](./6-joins.md)
- [Fetching Data](./7-fetching-data.md)
- [Struct Entities](./8-struct-entities.md)
Expand Down

0 comments on commit 6ed1f77

Please sign in to comment.