Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPSTREAM.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ touches the same area may be assuming the behaviour we replaced.
| **Paging** | `dialect/sql/sqlpage` -- keyset cursors -- is ours. | `7714d7267` |
| **Create read-back** | `sqlgraph.CreateSpec` carries `Returning`, `ScanValues` and `Assign`, and a create reads back the row it stored: by the INSERT, with `RETURNING`, where the dialect has it, and by a query after it on MySQL or with a conflict clause. `sql/returning` gives a create builder `Stored`, which asks for it, in a `CreateBulk` as well: a batch reads every row back, matched to its node by the Id the caller gave, or by its place when the database made the Ids up. Upstream's INSERT answers with the Id and nothing else. | #9, #11 |
| **Mutation expressions** | A generated mutation assigns a field a SQL expression (`SetFieldExpr`, `FieldExpr`, `ExprFields`; `SetField` hands one over), which an update writes and `Fields`/`Field` report to hooks. A validated, immutable, id or edge field refuses one, as does a create. `sqlgraph` writes a `sql.Querier` in a `FieldSpec` as SQL, even for a JSON column, which upstream would encode. Upstream's only route for an expression is `Modify`, which the mutation never sees. | #1 |
| **Set after clear** | A mutation's `SetX` drops a previous clear of an optional field, so `ClearX().SetX(v)` writes `v` once. Upstream emits `x = NULL, x = ?`, which PostgreSQL refuses. The same fix was offered upstream; drop this row once upstream has it. | #13 |
| **Time: zone** | Every `time.Time` is UTC at both edges. `bindArgs` moves an argument to UTC; `Rows.Scan` moves a scanned value to UTC; `field.Time`'s `Default`/`UpdateDefault` answer in UTC. | `7d10ad284`, `c6003ab94`, `1d1a9d88b` |
| **Time: precision** | Time columns keep six fractional-second digits by default; `field.Time().Precision(n)` says otherwise. | `cede1c296` |
| **Time: MySql column** | A time field is a `datetime`, not a `timestamp` -- no session `time_zone` conversion, no 2038. | `5d232985b` |
Expand Down
4 changes: 4 additions & 0 deletions entc/gen/template/mutation.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ func (m *Mutation) Predicates() []predicate.{{ $.Name }} {
{{- if $f.SupportsMutationAppend }}
m.append{{ $f.BuilderField }} = nil
{{- end }}
{{- /* Setting overrides a previous call to Clear, as Clear overrides a previous call to Set. */}}
{{- if $f.Optional }}
delete(m.clearedFields, {{ $const }})
{{- end }}
{{- if $f.SupportsMutationExpr }}
delete(m.exprs, {{ $const }})
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions entc/integration/cascadelete/ent/post/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions entc/integration/config/ent/user/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions entc/integration/customid/ent/car/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/customid/ent/doc/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/customid/ent/note/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/edgefield/ent/car/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions entc/integration/edgefield/ent/card/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/edgefield/ent/metadata/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/edgefield/ent/node/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/edgefield/ent/pet/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/edgefield/ent/post/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions entc/integration/edgefield/ent/user/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/edgeschema/ent/relationship/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions entc/integration/ent/card/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions entc/integration/ent/comment/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions entc/integration/ent/exvaluescan/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading