Commit Graph

23 Commits

Author SHA1 Message Date
Tarrence van As
dfc7a79f6d schema/field: support unique bytes (#1720) 2021-07-20 10:24:38 +03:00
Ariel Mashraki
2480b5c0ef entc/gen: wrap nillable fields with custom go-type with sql.nullscanner 2021-04-17 13:13:40 +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
2cc1c628dc schema/field: use actual go type in generated interfaces (#1428) 2021-04-07 09:53:44 +03:00
Ariel Mashraki
c0fd7c1305 entc/gen: add edge-field api for schema and codegen (#1213) 2021-03-07 22:51:17 +02:00
Matthew Gabeler-Lee
c53b45ddb0 all: use %w instead of %v to wrap errors (#1275)
* all: use %w instead of %v for nested errors with fmt.Errorf

* all: update generated code to use %w instead of %v for error wrapping
2021-03-03 20:05:33 +02:00
Ariel Mashraki
da34571560 entc/gen: allow selecting specific fields (#1075) 2020-12-23 17:35:39 +02:00
Ariel Mashraki
1783294d75 entc/gen: skip slicing on empty fields (#632) 2020-07-21 13:15:27 +03:00
Joel Courtney
e4d57a47f7 entc/gen: fix eager loading when using uuid for foreign keys failing if loading more than a single relation (#533)
* Bugfix: eager lodaing when using uuid for foreign keys failing if loading more than a single relation (#532)

* go generate ./... output
2020-06-09 08:10:14 +03:00
Ariel Mashraki
bf566aa3ac entc/gen: support valuescanner in go-types (#510) 2020-05-28 18:23:14 +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
2a7183eb82 entc/gen: fix uuid fks scanning (#382)
Fixes #363
2020-03-07 22:11:25 +02:00
Ariel Mashraki
caf721df47 entc/gen: add eager-loading support (#263)
* entc/gen: add OwnFK indicator for type edges

* entc/gen: add Edges field for generated types

* entc/gen: add With<T> method to query-builder template

* entc/gen: scan and assign foreign-keys on eager-loading

* entc/gen: load fk-relations (wip)

* entc/integration: add o2m/m2o tests for eager-loading

* entc/gen: add m2m support for eager-loading

* entc/gen: add integration tests for m2m and subgraphs

* entc/gen/integration: add tests for o2o eager-loading

* all: generate all assets
2020-01-13 17:21:26 +02:00
Ariel Mashraki
e5c5aec9b5 entc/gen: remove FromRows decoding 2019-12-24 10:29:40 +02:00
Ariel Mashraki
1c54439d40 entc/gen: move scan-assign to node def 2019-12-22 17:15:33 +02:00
Ariel Mashraki
8093ec4127 entc/gen: avoid using Go keywords as variables on scan
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/161

Reviewed By: alexsn

Differential Revision: D18483166

fbshipit-source-id: 7273d284232c1bf515cc84326904b580fb70a0e3
2019-11-13 11:35:58 -08: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
Hylke Visser
6a1c9e73fe entc/sql/decode: fix decoding of NullTime in optional and nillable time fields (#60)
Summary:
While trying out this project I think I found a bug in the generated code when using an optional and nillable time field.

```
vet: ent/user.go:46:16: cannot use &vu.DeletedAt (value of type *sql.NullTime) as *time.Time value in assignment
```

7438104b5d made a change to the `{{ $scan }}` struct, which now always uses `{{ $f.NullType }}` as type, so the `$f.IsTime` check can now be removed. This pull request does that.

This is my fist contribution here. I hope I didn't miss anything.
Pull Request resolved: https://github.com/facebookincubator/ent/pull/60

Differential Revision: D17760925

Pulled By: a8m

fbshipit-source-id: 675005be62487b1b9eb77302b8185bd3b6ef0195
2019-10-04 03:38:45 -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
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
7438104b5d entc/sql/decode: use null types for fields scanning
Reviewed By: alexsn

Differential Revision: D16890638

fbshipit-source-id: bfe3699831875a559d322a500ffc20a976f30a44
2019-08-19 05:02:37 -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
56656dfcb6 ent/entc: configure storage driver in codegen
Summary: Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1229

Reviewed By: alexsn

Differential Revision: D16539934

fbshipit-source-id: b3a8bf1f1be6f65ad3f649cd921ea20fc24182bf
2019-07-30 02:49:22 -07:00