mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
@@ -243,7 +243,7 @@ err := client.User.
|
||||
Create().
|
||||
SetName("Ariel").
|
||||
OnConflictColumns(user.FieldName).
|
||||
UpadteNewValues().
|
||||
UpdateNewValues().
|
||||
Exec(ctx)
|
||||
|
||||
// Setting the column names using the SQL API.
|
||||
@@ -253,7 +253,7 @@ err := client.User.
|
||||
OnConflict(
|
||||
sql.ConflictColumns(user.FieldName),
|
||||
).
|
||||
UpadteNewValues().
|
||||
UpdateNewValues().
|
||||
Exec(ctx)
|
||||
|
||||
// Setting the constraint name using the SQL API.
|
||||
@@ -263,7 +263,7 @@ err := client.User.
|
||||
OnConflict(
|
||||
sql.ConflictConstraint(constraint),
|
||||
).
|
||||
UpadteNewValues().
|
||||
UpdateNewValues().
|
||||
Exec(ctx)
|
||||
```
|
||||
|
||||
@@ -298,7 +298,7 @@ for such operations.
|
||||
err := client.User. // UserClient
|
||||
CreateBulk(builders...). // User bulk create.
|
||||
OnConflict(). // User bulk upsert.
|
||||
UpadteNewValues(). // Use the values that were set on create in case of conflict.
|
||||
UpdateNewValues(). // Use the values that were set on create in case of conflict.
|
||||
Exec(ctx) // Execute the statement.
|
||||
```
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ id, err := client.User.
|
||||
SetAge(30).
|
||||
SetName("Ariel").
|
||||
OnConflict().
|
||||
UpadteNewValues().
|
||||
UpdateNewValues().
|
||||
ID(ctx)
|
||||
|
||||
// In PostgreSQL, the conflict target is required.
|
||||
@@ -181,7 +181,7 @@ err := client.User.
|
||||
SetAge(30).
|
||||
SetName("Ariel").
|
||||
OnConflictColumns(user.FieldName).
|
||||
UpadteNewValues().
|
||||
UpdateNewValues().
|
||||
Exec(ctx)
|
||||
|
||||
// Bulk upsert is also supported.
|
||||
@@ -191,8 +191,8 @@ client.User.
|
||||
sql.ConflictWhere(...),
|
||||
sql.UpdateWhere(...),
|
||||
).
|
||||
UpadteNewValues().
|
||||
UpdateNewValues().
|
||||
Exec(ctx)
|
||||
|
||||
// INSERT INTO "users" (...) VALUES ... ON CONFLICT WHERE ... DO UPDATE SET ... WHERE ...
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user