mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
doc: json doc
Reviewed By: alexsn Differential Revision: D17475209 fbshipit-source-id: c418f43426cce3fb3b8296a1e274ba3f5bc2a9bc
This commit is contained in:
committed by
Facebook Github Bot
parent
c3955a08f1
commit
bc5e8316dd
@@ -51,6 +51,7 @@ The following types are currently supported by the framework:
|
||||
- `string`
|
||||
- `time.Time`
|
||||
- `[]byte` (only supported by SQL dialects).
|
||||
- `JSON` (only supported by SQL dialects) - **experimental**.
|
||||
|
||||
<br/>
|
||||
```go
|
||||
@@ -81,6 +82,10 @@ func (User) Fields() []ent.Field {
|
||||
Unique(),
|
||||
field.Time("created_at").
|
||||
Default(time.Now),
|
||||
field.JSON("url", &url.URL{}).
|
||||
Optional(),
|
||||
field.JSON("strings", []string{}).
|
||||
Optional(),
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user