Commit Graph

41 Commits

Author SHA1 Message Date
Ariel Mashraki
ded20a0e36 entc/gen: cleanup sql templates 2021-06-27 10:27:10 +03:00
Ariel Mashraki
c40ae45aee entc/gen: add support for summing custom Go numeric types 2021-06-25 17:30:17 +03:00
Ariel Mashraki
34aabc0eb1 entc/gen/template: add goland-annotation for template data-types 2021-04-09 17:53:04 +03:00
Ariel Mashraki
5d70144f44 entc/gen: allow selecting partial fields on update-one 2021-03-14 23:17:30 +02:00
Ariel Mashraki
c0fd7c1305 entc/gen: add edge-field api for schema and codegen (#1213) 2021-03-07 22:51:17 +02:00
Ariel Mashraki
f315801779 dialect/sql/sqlgraph: apply predicate on update-node 2021-01-22 23:04:09 +02:00
Ariel Mashraki
0c2c45f0c6 entc/gen/template: allow override context.Context with custom templates 2021-01-19 10:24:26 +02:00
Ariel Mashraki
d56537c606 entc/gen/template: allow mutating the sqlgraph.UpdateSpec by ent extensions or user templates 2021-01-19 09:51:38 +02:00
Ariel Mashraki
da34571560 entc/gen: allow selecting specific fields (#1075) 2020-12-23 17:35:39 +02:00
Ariel Mashraki
c2cdc52946 entc/gen: move predicates to mutation object (#825) 2020-10-07 14:22:14 +03:00
Ariel Mashraki
17abe2d60f entc/gen: less sophisticated naming logic (#774)
Closed #772
2020-09-17 09:19:55 +03:00
Ariel Mashraki
8e824c14eb entc/gen: add an option for clearing non-unique edges (#731)
Closed #398
2020-09-06 20:22:42 +03:00
Jelmer Snoeck
b150cde478 entc/gen: introduce validation errors (#547)
This introduces the concept of validation errors, where we have a high
level validation error which wraps a more detailed error message.

The higher level `ValidationError` is set up in the generated files, much
like the `NotFoundError` and `ConstraintError` and is accompanied by an
`IsValidationError` check method. Thus, it can be used as follows:

```go
t, err := tx.Team.Create().SetName(input.Name).Save(ctx)
if ent.IsValidationError(err) {
        // handle validation error response
}
```
2020-06-17 17:11:39 +03:00
Ariel Mashraki
86d345e187 entc/gen: add support for ValueScanner for int type (#530) 2020-06-08 14:54:37 +03:00
Ariel Mashraki
65f96b3593 entc/gen: remove legacy i2a support for ids (#389)
* entc/gen: remove legacy i2a support for ids

* integ: add customid tests for fk strings
2020-03-16 18:19:30 +02:00
Ariel Mashraki
7988d3084d entc/hooks: initial work for mutations and hooks (#377)
* entc/hooks: initial work for mutations and hooks

* ent/schema: adding policy to schema

* ent: change op string to uint

* entc: move entschema to runtime and enable smooth transition

* entc/privacy: adding privacy template

* all: goimports

* intg/hooks: mutation client/tx and basic schema tests

* ent/privacy: adding more verbose decisions

* entc/gen: edge-ids getter and additional tests

* all: regen assets

* entc/gen: fix client hookd propagation

* intg: add deletion example

* intg/privacy: remove old entschema package

* typed privacy

* ent/privacy: hooks shouldn't be called on privacy deny

* entc/gen: fix schema hooks invocation order

* remove read policy from public api

* update circleci go orb

Co-authored-by: Ariel Mashraki <ariel@mashraki.co.il>
2020-03-16 00:19:27 +02:00
Ariel Mashraki
d9c8d9545d entc/gen: use NotFoundError when updating non-exist node (#348)
Fixes #341
2020-02-16 13:26:13 +02:00
Ariel Mashraki
9b2b53f559 entc/gen: avoid conflict local vars with user packages (#292)
Fixes #284
2020-01-16 17:30:18 +02:00
Ariel Mashraki
7a85c04c32 entc/gen: add edge-fields + minor changes 2019-12-23 10:57:36 +02:00
Ariel Mashraki
c09028f58b dialect/sql/sqlgraph: consistent scan names 2019-12-22 20:12:00 +02:00
Ariel Mashraki
1c54439d40 entc/gen: move scan-assign to node def 2019-12-22 17:15:33 +02:00
Ariel Mashraki
7fde9b7642 entc/gen: move sql-update-one to sqlgraph 2019-12-22 13:32:51 +02:00
Ariel Mashraki
798d58f02b all: use more go-ish error for constraint failures 2019-12-17 23:17:55 +02:00
Ariel Mashraki
5fe9fcdc1b entc/gen: fix update ids check bug in user-defined-ids
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/203

Reviewed By: alexsn

Differential Revision: D18725824

fbshipit-source-id: 888686bb5fa87649be89ec1926cbd7a3b6cf7932
2019-11-27 06:20:44 -08:00
Ariel Mashraki
67c3fd2db9 entc/gen: initial work for supporting uuid fields in codegen
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/182

Reviewed By: alexsn

Differential Revision: D18638199

fbshipit-source-id: 0de79c78b51e544486c07a004c3c8ea82e5c3398
2019-11-24 07:11:23 -08:00
Ariel Mashraki
c259aee24b entc/gen: generate sql builders with dialect option
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/130

Reviewed By: alexsn

Differential Revision: D18164397

fbshipit-source-id: 2858d69d3ff85c06b51382c01c3d4369ee2c3bdb
2019-10-27 21:53:50 -07:00
Ariel Mashraki
36a3971f3d entc/gen: add struct field name to fields and edges
Summary: avoig logic in templates

Reviewed By: alexsn

Differential Revision: D17926168

fbshipit-source-id: d583e800fb4a45cf939e9788cea6d45e126c61fe
2019-10-15 06:42:44 -07:00
Ariel Mashraki
64ed7580c0 entc/gen: use BuilderField for builder memebrs
Summary: StructField should be used a member of the ent type (struct), and logic should be removed from templates.

Reviewed By: alexsn

Differential Revision: D17926151

fbshipit-source-id: f77c5ce8359816ec3a4ce1ab71dd98f205706deb
2019-10-15 06:42:44 -07:00
Ariel Mashraki
8e66691db5 entc: return ErrNotFound on UpdateOne
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/52

Reviewed By: alexsn

Differential Revision: D17737477

fbshipit-source-id: 13890619e0af28a28e3d7bd50d7e4287599eeaf0
2019-10-03 06:25:11 -07:00
Ariel Mashraki
0f71ca6ad8 entc/cmd/entc: support more numeric types for ids
Reviewed By: alexsn

Differential Revision: D17527952

fbshipit-source-id: 1465b054531cee8ca1dd445b6654063f32f4c4e3
2019-09-23 09:48:24 -07:00
Ariel Mashraki
c3955a08f1 schema/field: json type support (#38)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/38

Only `IsNil` and `NotNil` predicates are supported this moment

Reviewed By: alexsn

Differential Revision: D17444976

fbshipit-source-id: 37336fa0bc7749af995933baee2e23bb7366dd78
2019-09-19 05:00:11 -07:00
Ariel Mashraki
78a7509c52 entc: clear optional field values
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/33

Reviewed By: noamsch

Differential Revision: D17344992

fbshipit-source-id: 5336e9c5a4978e10923e26b5754942d92371a5cd
2019-09-15 04:44:55 -07:00
Ariel Mashraki
d820361a3a entc/gen: add inc/dec capability for numeric fields
Reviewed By: alexsn

Differential Revision: D17259987

fbshipit-source-id: ad5ba1ba7383418463bc9137d82f16eadef809e7
2019-09-10 06:00:34 -07:00
Ariel Mashraki
4323141fe2 ent: add license and copyright to template files
Reviewed By: alexsn

Differential Revision: D17149292

fbshipit-source-id: 837de5fad988de1e54438b47584701f2fc35326d
2019-09-01 03:03:15 -07:00
Ariel Mashraki
772b8a33f8 ent/field: add update_default option time field
Reviewed By: alexsn

Differential Revision: D17070907

fbshipit-source-id: 63c9ce75c58e524044c38f9461cb04e8e45c8017
2019-08-27 06:54:49 -07:00
Alex Snast
85b29631a8 entc/schema: adding support for immutable fields (#1340)
Summary:
Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1340

Immutable fields are ent fields which cannot be updated

Reviewed By: a8m

Differential Revision: D16899625

fbshipit-source-id: ca482c66570e84ca9a1e0a03f729847561f2816b
2019-08-20 02:17:13 -07:00
Ariel Mashraki
619b63d5f7 ent/schema: rename nullable to nillable
Reviewed By: idoshveki

Differential Revision: D16687892

fbshipit-source-id: e8cfaaf1241e94c2de0a9fe9077326339d593716
2019-08-07 06:56:33 -07:00
Ariel Mashraki
25f5a2ef01 entc/predicate: add isnull/notnull predicates for codegen
Reviewed By: idoshveki

Differential Revision: D16687226

fbshipit-source-id: 14a39e066447dbf77413e5c7f7318a2d61bddd32
2019-08-07 06:56:32 -07:00
Ariel Mashraki
2cfda7564f type safe predicates
Reviewed By: alexsn

Differential Revision: D16452717

fbshipit-source-id: da0a07275434d95d73a5a26830a2e5535c3abf47
2019-07-24 08:35:51 -07:00
Ariel Mashraki
e8e96f014f add charset support for fields
Summary: Basically, adding support for Hebrew characters.

Reviewed By: alexsn

Differential Revision: D16068537

fbshipit-source-id: 4e934da5ea97c9e804317f746556ab1d51faebcc
2019-07-01 08:10:24 -07:00
facebook-github-bot
267e3c15bd Initial commit
fbshipit-source-id: c79a38536e3c128dce1b2948615b72ec9779ed22
2019-06-16 04:37:51 -07:00