Commit Graph

111 Commits

Author SHA1 Message Date
Ariel Mashraki
5cd2ede22d dialect/entsql: add Skip annotation (#4156) 2024-07-26 23:03:21 +03:00
Ariel Mashraki
db2088c34a entc/gen: concurrent gofmt (#4104)
After #584 goimports does not need to resolve packages, and running concurrent fmt is faster than serialized one
2024-06-17 12:43:29 +03:00
sunxunle
c25a28565e entc/gen: fix doc typos (#3979)
Signed-off-by: sunxunle <sunxunle@gmail.com>
2024-03-18 08:33:08 +02:00
Jannik Clausen
5755614d3f entc/gen: support backticks in snapshot (#3851) 2023-12-07 21:35:48 +01:00
Ariel Mashraki
4640d8e0ec entc/gen: keep internal feature-flags private (#3832) 2023-11-16 09:39:27 +02: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
3b7715b552 dialect/sql/schema: allow setting table comments (#3365) 2023-03-04 20:50:26 +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
baec350ed4 entc/gen: support type-based matching for edge-schema columns (#3306)
In case of no match by foreign-keys, we search by edge-type. This can happen if the type (edge owner)
is named T, but the edge-schema E names its edge field as u_id. We consider it as a match if
there is only one usage of T in E.
2023-02-07 10:58:20 +02:00
Ariel Mashraki
41bf915604 entc/gen: support setting default values/exprs for edge-fields (#3203) 2023-01-02 14:19:01 +02:00
Ariel Mashraki
136807549d dialect/entsql: supports setting SQL column comments (#3191)
* feat: Add column comment in SQL DDL, using EntSQL annotations to achieve it.

* Update annotation.go

* fix lint

* Add table primary key column comment

* entsql.Comment(string)  is unnecessary

* entc/gen: minor changes to entsql.WithComments + add tests

Co-authored-by: chenghonour <wantto@outlook.com>
2022-12-26 14:48:37 +02:00
Ariel Mashraki
3f1d7c960e example: add jsonencode using extension (#3142) 2022-12-04 10:38:23 +02:00
Ariel Mashraki
b6a475f066 entc/gen: skip generating edge-schema unique indexes if defined 2022-11-23 18:56:02 +02:00
Ariel Mashraki
a91aabe3ef entc/gen: ensure foreign-key constraints are unique in codegen (#3066) 2022-11-05 07:28:50 +02:00
Ariel Mashraki
521f9b57bc entc/gen: copy annotations to the Through meta-edge 2022-10-31 15:55:57 +02:00
Joe Wreschnig
ac725a61b7 entc: add BuildFlags to schema loader configuration (#2801)
This allows passing arbitrary build flags to the schema package loader,
which in turn can be used to pass build constraints affecting what
schema types and/or methods are visible.

As a particular use case, this should make it easier to implement
two-pass code generation to deal with circular imports in hooks (#892).
2022-10-16 16:53:47 +03:00
Ariel Mashraki
b18ca9ca6f schema/edge: allow setting immutable edges (#2876) 2022-08-20 19:10:16 +03:00
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +03:00
Ariel Mashraki
01f97334af entc/gen: use custom schema-type in join tables foreign-keys (#2760)
Fixed https://github.com/ent/ent/issues/2753
2022-07-15 11:01:13 +03:00
Ariel Mashraki
2c1a3555cc entc/gen: ignore edge-fields order in edge-schema with composite identifiers (#2719)
This PR allows defining edge schemas with any order of their edges
but still enforce the ordering of the fields in the ID annotation
2022-07-05 15:45:28 +03:00
Giau. Tran Minh
4f7b1739cd entc: cleanup defaults ID (#2709) 2022-07-01 23:30:18 +03:00
Ariel Mashraki
904b649120 entc/gen: skip nodes with composite id types on default id-type detection (#2708)
Was reported on Discord
2022-07-01 23:08:45 +03:00
Ariel Mashraki
fd955654a0 entc/gen: change codegen signature from entc to ent (#2627) 2022-06-07 17:48:17 +03:00
Ariel Mashraki
e634960221 entc/gen: move a8m/entclean logic to ent (#2612) 2022-06-05 14:31:45 +03:00
Ariel Mashraki
e1c5277483 ent: initial support for edge schemas (#2560) 2022-05-25 15:46:00 +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
0c7679e571 entc/gen: set Ref and Inverse for edge contains both From and To 2022-03-08 22:28:50 +02: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
898991ac79 entc/gen: set foreign-key columns non-nullable for required edges (#1703)
Note, this only applies to edges without circular references.
Fixed #1688 and #1374
2022-01-23 22:23:37 +02:00
Ariel Mashraki
fd3b29f785 entc/gen: import gen.Config documentation (#2189) 2021-12-01 14:41:55 +02:00
Ariel Mashraki
51b63c17c0 entc/gen: fix module version extraction when running entc as a package 2021-10-29 09:13:16 +03: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
82eeeb5a1c entc/gen: introduce the entc.Dependency option 2021-10-26 20:33:04 +03:00
Ariel Mashraki
11843ff867 go: upgrade to 1.17 2021-08-21 00:14:22 +03:00
Ariel Mashraki
6ff6e81652 doc/template: add docs for template helpers 2021-07-20 09:57:28 +03:00
Ariel Mashraki
81eeefa6a2 entc/gen: add support for helper templates
Closed #1655
2021-07-20 09:57:28 +03:00
Ariel Mashraki
297067712f entc/gen: pass referenced columns schema-type to fk columns
Fixed #1699
2021-07-09 15:40:52 +03:00
Ariel Mashraki
66871c9806 dialect/sql/schema: add support for index prefixes in mysql 2021-06-09 22:52:31 +03:00
Ariel Mashraki
30c947546f entc: add global annotations option 2021-04-11 13:58:10 +03:00
Ariel Mashraki
f3f03e1edd schema/edge: add support for configuring foreign-key symbols
Fixed #1423
2021-04-04 15:27:57 +03:00
Ariel Mashraki
9685066b83 entc/gen: support on-delete annotation in migrate/schema 2021-03-16 15:29:21 +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
Ariel Mashraki
0d0a93b95f entc/gen: add support for referencing fks to existing fields (#1289) 2021-03-01 22:57:32 +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
aeb1ccc571 entc/gen: move schemaconfig template to feature-flag 2021-01-24 19:57:28 +02:00
Ariel Mashraki
0e7823383e entc/gen: add default json tag for edge fields (#1204) 2021-01-23 21:23:52 +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
27d5c254d7 entc/gen: reject duplicate edge/field names (#1029) 2020-12-10 13:47:15 +02:00
Nathaniel Peiffer
42fa731f39 all: fix linting errors for comments (#990)
* fix: linting errors for comments

* fix: one more comment
2020-11-27 07:02:18 +02:00