Commit Graph

27 Commits

Author SHA1 Message Date
Ariel Mashraki
d432d880c7 entc/load: add go module info to schema spec (#2175) 2021-12-01 11:30:38 +02:00
Ariel Mashraki
41e2d0c9b5 entc/load: replace bindata with package embed 2021-08-21 17:13:44 +03:00
Ariel Mashraki
11843ff867 go: upgrade to 1.17 2021-08-21 00:14:22 +03:00
Ariel Mashraki
6b939670f5 entc/load: improve godoc and add pkgpath to errors 2021-04-28 11:11:44 +03:00
Ariel Mashraki
30c947546f entc: add global annotations option 2021-04-11 13:58:10 +03: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
dd4792f5b3 go: rename module from github.com/facebook/ent => entgo.io/ent (#1226) 2021-02-02 23:03:04 +02:00
Alex Snast
29cd5f2750 entc: drop deprecated packages.LoadSyntax usage (#1039) 2020-12-14 08:56:33 +02:00
Aleksandr Razumov
8139aca845 entc/gen: fix typo in MaskNotFound func comment (#904)
* entc: use go-bindata --mode flag

This prevents unexpected changes in generated files if
system file mode is different from generated.

* entc/gen: fix typo in "MaskNotFound" func comment
2020-10-30 20:52:57 +02:00
Ariel Mashraki
98aeb19013 entc/internal: add snapshot restore logic (#862)
Issue #852
2020-10-19 14:51:28 +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
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
bb852ad093 intgeration: add pg and mysql test for customids (#342) 2020-02-12 20:42:03 +02:00
Ariel Mashraki
d2fe7199e5 entc/load: return packages.Load error when 'go list' fails (#187)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/187

Also, remove the dependency of pkg/errors from load package.

Reviewed By: alexsn

Differential Revision: D18672979

fbshipit-source-id: 88a881a99e93896f8d3a0aefcf61fbd995b7fa08
2019-11-24 07:11:22 -08:00
Ariel Mashraki
6ce4cb6803 all: fix minor lint errors
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/159

Reviewed By: dlvhdr

Differential Revision: D18476131

fbshipit-source-id: 9e792f5a35f25233aad73f75f12d13d215a21ad2
2019-11-13 06:01:41 -08:00
Alex Snast
75f59d76ad ent/entc: drop modtime from generated bindata
Summary: Keep bindata code consistent accross `go generate` executions.

Reviewed By: a8m

Differential Revision: D17977276

fbshipit-source-id: 7bc1eecf23f59c0732399ec69e484a594a611d31
2019-10-17 01:55:41 -07:00
Ariel Mashraki
c6b395904c entc/load: avoid panic due to index out of range (#99)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/99

go/packages now returns partial packages instead of error and this can cause an index of out range.

Reviewed By: alexsn

Differential Revision: D17939156

fbshipit-source-id: d02867a0cca5f1e90ac4952ac4136d8c8086a944
2019-10-15 22:17:02 -07:00
Ariel Mashraki
c5b790043c entc: change the way we inject additional fields (#1560)
Summary:
Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1560

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

Reviewed By: alexsn

Differential Revision: D17931147

fbshipit-source-id: 24e1d72be482cb787c557f46feeb2ed4a31dfe60
2019-10-15 12:00:46 -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
e668326c5e ent/entc: set go-bindata version in go.mod (#74)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/74

don't rely on local go-bindata binary

Reviewed By: a8m

Differential Revision: D17786303

fbshipit-source-id: 1d1258478fd8f3abcdb3a7b1b06d0601b4468c94
2019-10-07 02:20:47 -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
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
61b8ccea4a entc/load: enable adding additional fields to the generated entities
Summary: In some cases (like xwf auth service), you want to add additional fields to the generated model.

Reviewed By: alexsn

Differential Revision: D17223674

fbshipit-source-id: fb4be71b388c6bd107e6bac242133c237fe25599
2019-09-08 08:05:13 -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
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
ba950aac52 entc/load: add support for embedding schemas
Reviewed By: alexsn

Differential Revision: D16884402

fbshipit-source-id: 216bbf875251b0cbdd61e312ad763b439cab7813
2019-08-18 04:30:14 -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