mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
doc/crud: field selection for update
This commit is contained in:
committed by
Ariel Mashraki
parent
5d70144f44
commit
6c4d34e91b
@@ -262,6 +262,19 @@ if err != nil {
|
||||
}
|
||||
```
|
||||
|
||||
Update an entity and return a partial of it.
|
||||
|
||||
```go
|
||||
pedro, err := client.Pet.
|
||||
UpdateOneID(id).
|
||||
SetAge(9).
|
||||
SetName("pedro").
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
Select(pet.FieldName).
|
||||
Save(ctx)
|
||||
```
|
||||
|
||||
## Delete One
|
||||
|
||||
Delete an entity.
|
||||
|
||||
Reference in New Issue
Block a user