You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SeaORM/docs/04-generate-entity/05-newtype.md
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ You can define a New Type (`T`) and use it as model field. The following traits
7
7
3. Implement [`sea_query::ValueType`](https://docs.rs/sea-query/*/sea_query/value/trait.ValueType.html) for `T`
8
8
4. Implement [`sea_query::Nullable`](https://docs.rs/sea-query/*/sea_query/value/trait.Nullable.html) for `T`
9
9
10
-
## Wrapper Type
10
+
## Wrapping scalar types
11
11
12
12
You can create new types wrapping any type supported by SeaORM.
13
13
@@ -154,7 +154,7 @@ impl sea_orm::sea_query::Nullable for Integer {
154
154
155
155
## Wrapping `Vec<T>` (backend generic)
156
156
157
-
You can also define a backend-generic `Vec<T>` field by serialize / deserialize the object to / from JSON:
157
+
You can also wrap a `Vec<T>` field by serialize / deserialize the object to / from JSON. This is a backend-generic way of supporting array types across databases.
158
158
159
159
```rust
160
160
usesea_orm::entity::prelude::*;
@@ -220,6 +220,33 @@ impl sea_orm::sea_query::Nullable for ObjectVec {
220
220
```
221
221
</details>
222
222
223
+
## Treat any type as JSON
224
+
225
+
In addition to wrapping `Vec<T>`, the `FromJsonQueryResult` macro can be used on any type that implements `serde`'s `Serialize` and `Deserialize`, and they will be converted to/from JSON when interacting with databases.
Since `1.1.8`, `DeriveValueType` also supports `enum` types. It offers a simpler alternative to `DeriveActiveEnum` for client-side enums backed by string database types.
Copy file name to clipboardExpand all lines: SeaORM/versioned_docs/version-1.1.x/04-generate-entity/05-newtype.md
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ You can define a New Type (`T`) and use it as model field. The following traits
7
7
3. Implement [`sea_query::ValueType`](https://docs.rs/sea-query/*/sea_query/value/trait.ValueType.html) for `T`
8
8
4. Implement [`sea_query::Nullable`](https://docs.rs/sea-query/*/sea_query/value/trait.Nullable.html) for `T`
9
9
10
-
## Wrapper Type
10
+
## Wrapping scalar types
11
11
12
12
You can create new types wrapping any type supported by SeaORM.
13
13
@@ -138,7 +138,7 @@ impl sea_orm::sea_query::Nullable for Integer {
138
138
139
139
## Wrapping `Vec<T>` (backend generic)
140
140
141
-
You can also define a backend-generic `Vec<T>` field by serialize / deserialize the object to / from JSON:
141
+
You can also wrap a `Vec<T>` field by serialize / deserialize the object to / from JSON. This is a backend-generic way of supporting array types across databases.
142
142
143
143
```rust
144
144
usesea_orm::entity::prelude::*;
@@ -204,6 +204,33 @@ impl sea_orm::sea_query::Nullable for ObjectVec {
204
204
```
205
205
</details>
206
206
207
+
## Treat any type as JSON
208
+
209
+
In addition to wrapping `Vec<T>`, the `FromJsonQueryResult` macro can be used on any type that implements `serde`'s `Serialize` and `Deserialize`, and they will be converted to/from JSON when interacting with databases.
Since `1.1.8`, `DeriveValueType` also supports `enum` types. It offers a simpler alternative to `DeriveActiveEnum` for client-side enums backed by string database types.
0 commit comments