Skip to content

Commit

Permalink
docs: add orm mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Oct 1, 2023
1 parent 14dffe4 commit b036a57
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,33 @@ Storage Support:
![demo](./static/images/demo.png)

### Features
- ORM Mapping
```rust
#[derive(Debug, Clone, Default)]
pub struct Post {
pub post_title: String,
pub post_date: NaiveDateTime,
pub post_body: String,
}

implement_from_tuple!(Post, (
post_title: String => |post: &mut Post, value: DataValue| {
if let Some(title) = value.utf8() {
post.post_title = title;
}
},
post_date: NaiveDateTime => |post: &mut Post, value: DataValue| {
if let Some(date_time) = value.datetime() {
post.post_date = date_time;
}
},
post_body: String => |post: &mut Post, value: DataValue| {
if let Some(body) = value.utf8() {
post.post_body = body;
}
}
));
```
- SQL field options
- not null
- null
Expand Down

0 comments on commit b036a57

Please sign in to comment.