Commit Graph

47 Commits

Author SHA1 Message Date
Ariel Mashraki
5450481513 entc/gen: add support for passing functions to external templates (#732)
Fixed #671
2020-09-07 12:02:22 +03:00
Ariel Mashraki
5e56543133 schema/edge: fix edge annotations with to/from builders (#679) 2020-08-20 12:15:43 +03:00
Ariel Mashraki
fd0a7f9f02 all: facebookincubator/ent => facebook/ent (#660)
ent repository is going to be migrated to facebook organization
2020-08-18 11:05:08 +03:00
Ariel Mashraki
05dfd6b78b schema/edge: add annotation support for edges (#651) 2020-08-01 15:38:47 +03:00
Ariel Mashraki
1a8d98f507 entc/gen: add option to extend existing templates (#583) 2020-07-05 14:48:18 +03:00
Ariel Mashraki
47f1a203aa schema/edge: an storage-key option for edges (#545)
* schema/edge: an storage-key option for edges

* schema/edge: use Column(s) with functional options
2020-06-15 23:06:00 +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
0f08a0b5f4 entc/gen: use ref-table primary-key type/size for fk attrs (#373)
Fixes #372
2020-03-04 11:14:05 +02:00
Ariel Mashraki
bb852ad093 intgeration: add pg and mysql test for customids (#342) 2020-02-12 20:42:03 +02:00
Ariel Mashraki
b4255998bf entc/gen: change name format for edge fks (#286)
* entc/gen: change name format for edge fks

* dialect/sql/schema: add fixture support for mysql and postgres

* sql/dialect: merge fkcolumn queries to one for the 2 dialects
2020-02-03 15:41:55 +02:00
Ariel Mashraki
28b9ef193f entc/gen: fix assoc-inverse struct tags assignments (#309) 2020-01-22 04:50:37 -05: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
b54007ef56 Entc/enums (#271)
* ent: add default value setter to enum builder

Co-authored-by: Dario Ielardi <dario.ielardi@gmail.com>
2020-01-05 18:31:35 +02:00
Ariel Mashraki
7a85c04c32 entc/gen: add edge-fields + minor changes 2019-12-23 10:57:36 +02:00
Ariel Mashraki
e85b10be36 entc/gen: remove multi storage support 2019-12-15 14:48:55 +02:00
Ariel Mashraki
e54373f410 ent: allow non-numeric columns as PKs
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/180

Reviewed By: alexsn

Differential Revision: D18636443

fbshipit-source-id: f14b34926817f6d9652f49a640bfb377f3f3cdaf
2019-11-21 08:49:58 -08:00
Ariel Mashraki
38002e6d2e entc/gen: use custom id type in join table (#165)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/165

Only when it's provided by the use explicitly

Reviewed By: alexsn

Differential Revision: D18506319

fbshipit-source-id: 4cc0bb2c3bbb26f8b27b12e4aa01407fb604928d
2019-11-14 09:47:35 -08:00
Ariel Mashraki
d9da7243f9 entc/gen: initial support for user-defined ids
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/162

Reviewed By: alexsn

Differential Revision: D18485086

fbshipit-source-id: 9bb6ccff592bc0cb8b218625161ed492f67bc170
2019-11-14 08:21:31 -08:00
Ariel Mashraki
e161ecc29c cmd/entc: remove graph printing from generator
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/163

Reviewed By: alexsn

Differential Revision: D18503829

fbshipit-source-id: 1269d4c8c30f848c5096258f2328230f5f378f69
2019-11-14 08:21:30 -08:00
Ariel Mashraki
0c46ce4e5e entc/gen: move multistorage logic to Go code
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/94

Reviewed By: alexsn

Differential Revision: D17926186

fbshipit-source-id: b59dc418703bc4faca5230a7354edea1423b7d35
2019-10-15 06:42:44 -07:00
Ariel Mashraki
c2418a1907 entc/gen: suspended goimports after files were written (#89)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/89

We can't run "imports" on files when the state is not completed. Because, "goimports" will drop undefined package. Therefore, it's suspended to end of the writing.

Fixed #88

Reviewed By: alexsn

Differential Revision: D17899321

fbshipit-source-id: 198dae11b121869764ebc9eee92110caf4256bed
2019-10-13 07:03:11 -07:00
Alex Snast
ce2bc07c1a ent/circleci: adding linter tests
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/80

Reviewed By: a8m

Differential Revision: D17837182

fbshipit-source-id: 9fb539fd6cebc064d2d2804bd52e0fbf413cfc93
2019-10-10 04:45:07 -07:00
Ariel Mashraki
7597f07912 entc: add option to use entc as package
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/72

Reviewed By: alexsn

Differential Revision: D17783580

fbshipit-source-id: 597f124a28415fef66b0b16811ad2acac8df631d
2019-10-07 07:06:32 -07:00
Alex Snast
2a6060a3ab ent/entc: no need to pass options to imports.Process
Summary: default options produce the same formatted output

Reviewed By: a8m

Differential Revision: D17760716

fbshipit-source-id: 556dc11e4c48c480e704f28ec779ec721137a9ba
2019-10-04 04:11:03 -07:00
Ariel Mashraki
480eb714d3 entc/gen: replace goimports with golang.org/x/tools/imports
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/53

Reviewed By: alexsn

Differential Revision: D17738814

fbshipit-source-id: 9865bc3c8eec766bd5c8e02db5c7afcaadb48c1f
2019-10-03 12:08:34 -07:00
Ariel Mashraki
3f7553af20 entc/gen: add tag ignoring for private fields
Summary: Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1487

Reviewed By: alexsn

Differential Revision: D17527793

fbshipit-source-id: b264706b8af74ff94d384dddd1b5a14661478676
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
ade72ced0d entc/integration: test external templates with node interface (#31)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/31

node template is just a template used for testing.

Reviewed By: dlvhdr

Differential Revision: D17327549

fbshipit-source-id: 803ac26df1b866e721edee97999d199b0935098b
2019-09-12 01:24:16 -07:00
Ariel Mashraki
6915b13d25 ent/gen: add support for external tempaltes execution
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/30

Reviewed By: dlvhdr

Differential Revision: D17318127

fbshipit-source-id: eccc2963f648296e222de9d002ab3caa8fac1389
2019-09-11 12:18:34 -07:00
Ariel Mashraki
2cc229eeb2 entc/gen: reject edge with mismatch type for back-ref
Reviewed By: alexsn

Differential Revision: D17260642

fbshipit-source-id: ef25dc77d9e4a7986e86d859f4f776fcf34336c9
2019-09-10 06:00:34 -07:00
Ariel Mashraki
b2cedc6c95 entc: move bindata files to internal packages
Summary: godoc was showing "Code generated by go-bindata. (generated) DO NOT EDIT." in the package description and exposing its methods.

Reviewed By: alexsn

Differential Revision: D17253564

fbshipit-source-id: c82082b4fa6adfba2c2663efbfacefb6423f89d9
2019-09-08 10:14:53 -07:00
Ariel Mashraki
bd07c86b60 all: add license header to all go files
Summary:
Used addlicense to generate this:
 addlicense -c "Facebook Inc" -f license_header .

example was taken from: https://github.com/facebook/litho/blob/master/lib/soloader/BUCK

Reviewed By: alexsn

Differential Revision: D17070152

fbshipit-source-id: e7b91398d7f6181727be3400c1872ad5f28e38ed
2019-08-27 04:48:28 -07:00
Ariel Mashraki
4c3951d53b ent/doc: m2m relation example
Reviewed By: alexsn

Differential Revision: D17050405

fbshipit-source-id: 85c41c92b15979b7aac8a6278a480cd593272f8a
2019-08-26 05:13:39 -07:00
Ariel Mashraki
52292557f6 entc/indexes: inverse only restriction applies only on O2O relation
Reviewed By: alexsn

Differential Revision: D17004823

fbshipit-source-id: 08b62960b447a157419dbeefd80ca1fcd29efd76
2019-08-25 06:41:14 -07:00
Ariel Mashraki
84c1b93e4e entc/gen: block circular deps between edges
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/25

Reviewed By: alexsn

Differential Revision: D16962429

fbshipit-source-id: 590adc530bc5c122153a55187d557714c42dff32
2019-08-22 07:41:30 -07:00
Ariel Mashraki
e0e754717e ent: change ent package name (#1338)
Summary:
Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1338

Pull Request resolved: https://github.com/facebookincubator/ent/pull/14

Reviewed By: alexsn

Differential Revision: D16890825

fbshipit-source-id: 656baaa73f5debab08c849b6b9639caeec2a8ef1
2019-08-19 09:32:14 -07:00
Ariel Mashraki
c16d3c8e25 ent/schema: explicitly defines non-null fields in schema
Reviewed By: alexsn

Differential Revision: D16791620

fbshipit-source-id: bad3ac7b2349d2f483c804eb3623c6dfa8b06313
2019-08-15 03:37:17 -07:00
Ariel Mashraki
108affa8dd ent/schema: move schema packages into a separate package
Reviewed By: alexsn

Differential Revision: D16763332

fbshipit-source-id: e3e4279c62992de192464c3d3b1036c45687507c
2019-08-12 07:53:03 -07:00
Ariel Mashraki
2128fc2ca1 ent/index: add indexes api
Reviewed By: alexsn

Differential Revision: D16757699

fbshipit-source-id: 6a0027b1f855721f1415b8c72b5b1be8bc2ce902
2019-08-12 06:44:40 -07:00
Ariel Mashraki
c5259c8528 entc: add relevant example-code for bytes field
Reviewed By: alexsn

Differential Revision: D16639870

fbshipit-source-id: 948cb0256fc8691a6c2194ee31db984d6ac1aede
2019-08-04 04:22:36 -07:00
Ariel Mashraki
66ea49049a entc: report informative message when goimports is not in PATH
Summary: Learning from the remote troubleshoot session I had with Murtadha on Friday - this could save me and him a lot fo time.

Reviewed By: alexsn

Differential Revision: D16639856

fbshipit-source-id: dc2a6b693b617fcd8061757987a6db95af4be2b6
2019-08-04 04:05:06 -07:00
Ariel Mashraki
2cc8286f5f entc: add idtype option codegen
Reviewed By: alexsn

Differential Revision: D16601757

fbshipit-source-id: 35d5fbfb4ef40bae192e084ad4e067880175e71c
2019-08-04 03:13:01 -07:00
Ariel Mashraki
c203f043cf ent: add blob tyoe
Reviewed By: idoshveki

Differential Revision: D16600425

fbshipit-source-id: 04c6fe39f9b3b628a1e79eb3063188f582d9e504
2019-08-01 07:45:05 -07:00
Ariel Mashraki
2c8b5a65b7 entc: abandon plugins
Summary:
Go plugin is not a good solution for both internal and external usage.
It's hard to manage and maintain matching versions (both Go and external libraries), and it does not support Windows.

Reviewed By: alexsn

Differential Revision: D16582217

fbshipit-source-id: 81876d2c6f30bbfc16ecf9e5000f0670f2e62484
2019-08-01 05:07:48 -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
facebook-github-bot
267e3c15bd Initial commit
fbshipit-source-id: c79a38536e3c128dce1b2948615b72ec9779ed22
2019-06-16 04:37:51 -07:00