Skip to content

Commit bd5fbcf

Browse files
committed
docs: update README with new schema api
1 parent 5157857 commit bd5fbcf

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@ The schema lib's purpose is to define your microservice models which will be use
3333

3434
```rust
3535
// schema/src/lib.rs
36-
37-
register_schemas!(Product);
38-
39-
#[derive(Model)]
40-
pub struct Product {
41-
pub id: Uuid,
42-
pub created_at: DateTime<FixedOffset>,
43-
pub updated_at: DateTime<FixedOffset>,
44-
pub name: String,
45-
#[awto(max_len = 120)]
46-
pub description: Option<String>,
47-
#[awto(default = 0)]
48-
pub price: i64,
36+
use awto::prelude::*;
37+
38+
schema! {
39+
#[database_table]
40+
#[protobuf_message]
41+
pub struct Product {
42+
pub id: Uuid,
43+
pub created_at: DateTime<FixedOffset>,
44+
pub updated_at: DateTime<FixedOffset>,
45+
pub name: String,
46+
#[awto(max_len = 120)]
47+
pub description: Option<String>,
48+
#[awto(default = 0)]
49+
pub price: i64,
50+
}
4951
}
5052
```
5153

0 commit comments

Comments
 (0)