63 Commits

Author SHA1 Message Date
Ariel Mashraki
1391816b77 entc/gen: move most mutation logic to be per type package (#4493) 2026-04-25 23:01:25 +03:00
Aman Bansal
a85a229311 entc.gen: support adding extra fields to mutations (#4281)
* ability to add additional fiels to type xxMutation {}

* Update entc/gen/template.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* Update entc/gen/template/builder/mutation.tmpl

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

---------

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2024-12-22 21:00:06 +02:00
Ariel Mashraki
15bebe8d89 ent: support schema view (#4157) 2024-07-28 19:00:47 +03:00
Ariel Mashraki
9aba4ae091 entc/gen: initial work for multi-schema migration using atlasgo.io (#3821) 2023-11-13 12:35:31 +02:00
Ariel Mashraki
89e2d52000 entc/gen: merge context.go contents to ent.go file (#3355) 2023-02-28 11:55:34 +02:00
Ariel Mashraki
770bb0f1a2 entc/gen: merge generate config.go file with client.go (#3319) 2023-02-16 12:08:41 +02:00
Ariel Mashraki
f226627d67 ent: export query interceptors (#3157) 2022-12-19 10:17:10 +02:00
Ariel Mashraki
da9322fd2e entc/gen: remove unnecessary import from templates (#3105) 2022-11-18 21:45:48 +02:00
Ariel Mashraki
53bdc325c0 entc/gen/schemaconfig: set alternate edge-schema names from config (#3087)
Fixed https://github.com/ent/ent/issues/3082
2022-11-12 21:42:57 +02:00
Ariel Mashraki
9673a4d506 entc/gen: allow naming ent/schema as Field (#2811) 2022-07-29 13:17:20 +03:00
Ariel Mashraki
4a26cab734 improve multi-tenancy example and documentation (#2705)
* example/privacytenant: support edge-field and improve code examples

* md/privacy: improve multi-tenancy documentation
2022-06-30 19:57:56 +03:00
Ariel Mashraki
f2e0bef7a8 entc/gen: add conditional-write option to external templates (#2542) 2022-05-12 07:36:15 +03:00
Ariel Mashraki
89c339209e entc/gen: add the sql/execquery feature flag (#2447) 2022-04-06 13:34:22 +03:00
Ariel Mashraki
05246cbd26 gen/entc/template: add option to process nodes after query using external templates (#2444) 2022-04-02 22:01:28 +03:00
Ariel Mashraki
48bb70f056 entc/gen: allow adding extra fields to the generated edges (#2437) 2022-03-29 14:54:16 +03:00
Ariel Mashraki
0e49dd1d9f entc/gen: support local package names for generated packages
The new Alias option adds package aliases (local names) for all type-packages that
their import identifier conflicts with user-defined packages (i.e. GoType).
2022-02-02 15:50:00 +02:00
Ariel Mashraki
909d24cfc4 entc/gen: support merging dep annotations
This will make it possible to get dependencies
from external extensions.
2021-10-28 11:08:05 +03:00
Ariel Mashraki
368a8f7a2e entc/gen: replace bindata with package embed 2021-08-21 17:13:44 +03:00
Ariel Mashraki
09c4306378 entc/gen: add support for upsert/on-conflict feature-flag 2021-08-04 14:01:31 +03:00
Ariel Mashraki
6a7b3c8e7a entc/gen: add feature-flag and implementation for sql/lock
Fixed #358
2021-07-21 11:50:06 +03:00
Ciaran Liedeman
eff6552989 entc/gen: allow users to alter Query initialization using templates (#1453)
* Templating: Allow user to alter Query struct init

* Update entc/gen/template/dialect/sql/query.tmpl

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* pr feedback

* renamed template

* changed sql to *

* to tabs

* removed old template

* update bin-data

* Update entc/integration/template/ent/template/query.tmpl

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* restore newline

* update bindata

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-04-14 14:04:29 +03:00
Ariel Mashraki
970887b4d0 entc/gen/template: add extend-templates for all builders (#1364) 2021-03-20 21:46:15 +02:00
Ariel Mashraki
76ffcc4adc entc/gen: allow extending config options from global templates (#1334) 2021-03-14 12:21:42 +02: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
Pavel Kerbel
3ee6621194 entc/gen: added ability to add comment to schema with external template (#1249)
This change will allow using external tools (such as swagger) to add comments to the schema.
For example, by adding a Swagger annotation to the schema we can add // swagger:model comment.
2021-02-08 13:02:56 +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
Ariel Mashraki
f5158dce55 entc/gen: move schema/snapshot template to its feature-flag (#1211) 2021-01-26 23:13:33 +02:00
Ariel Mashraki
aeb1ccc571 entc/gen: move schemaconfig template to feature-flag 2021-01-24 19:57:28 +02:00
Ariel Mashraki
3f57feb63a entc/gen: add external import templates to patterns (#1199) 2021-01-21 13:46:41 +02:00
Ariel Mashraki
0f78dfe1c0 entc/gen/template: allow mutating the sqlgraph.EdgeQuerySpec by ent extensions or user templates 2021-01-19 09:51:38 +02:00
Ariel Mashraki
63eb68a269 entc/gen/template: allow mutating the sqlgraph.CreateSpec by ent extensions or user templates 2021-01-19 09:51:38 +02:00
Ariel Mashraki
aa73b9067f entc/gen/template: allow extensions to extend the import templates 2021-01-19 09:11:37 +02:00
Ariel Mashraki
a53921b02e entc/integ: add tests for custom config option 2021-01-05 11:05:08 +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
17ee19e23a entc/gen: add gen.Template for ent extensions (#859) 2020-10-18 14:17:20 +03:00
Ariel Mashraki
fae1956828 entql: add typed-builder for field predicates 2020-10-11 14:41:03 +03:00
Ariel Mashraki
5d2d2757a8 entc/gen: allow passing client-fields from multiple templates (#819) 2020-10-04 22:19:58 +03:00
Ariel Mashraki
6cf2271c1b entc/gen: initial version for feature-flags (#803) 2020-09-29 16:22:50 +03:00
Ariel Mashraki
235973cc2d entc/gen: merge all templates to global 2020-09-15 16:31:29 +03:00
Ariel Mashraki
e26e99b643 entc/gen: improve the api for custom templates 2020-09-15 16:31:29 +03:00
Ciaran Liedeman
54774960b2 entc/gen: add template for creating custom predicates (#758)
* Custom Predicates

* Update entc/integration/template/ent/template/where.tmpl

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>


Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2020-09-14 15:41:48 +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
1a8d98f507 entc/gen: add option to extend existing templates (#583) 2020-07-05 14:48:18 +03:00
Ariel Mashraki
d3b89fb2be entc/gen: add enttest package for generated code. (#442)
* entc/gen: add enttest package for generated code.

It's still WIP and another 2 things need to be added:
- Add an option to skip schema migration and pass client options
- Update docs and replace existing testing code to use enttest

* entc/gen: finish enttest package tempalte

Signed-off-by: Alex Snast <alexsn@fb.com>

Co-authored-by: Alex Snast <alexsn@fb.com>
2020-04-20 16:37:26 +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
dc222c0b15 entc/gen: remove example_test template from codegen (#351)
Fixes #297
2020-02-18 12:26:46 +02:00
Ariel Mashraki
e85b10be36 entc/gen: remove multi storage support 2019-12-15 14:48:55 +02: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