Commit Graph

156 Commits

Author SHA1 Message Date
Ariel Mashraki
9e809635b2 entc/gen: ignore immutable fields on Upsert<T>.UpdateNewValues
Also, for some reason, the TimeMixin.UpdateTime was an immutable field,
but this was incorrent, because the codegen just skip generating
update setters to it. Removing the Immutable modifier allows users
to set this field explicitly.
2021-10-08 08:20:05 +03:00
Ariel Mashraki
87e2199309 entc/integration: add example for bytes id with custom comparable Go type 2021-09-29 18:31:01 +03:00
Ariel Mashraki
625e422a08 entc/gen: fix bug with enum separators
Fixed https://github.com/ent/ent/issues/1961
2021-09-24 00:03:59 +03:00
Ariel Mashraki
4c2faf2282 entc/gen: allow spaces in enum fields 2021-09-23 23:23:28 +03:00
Ariel Mashraki
430a3ee8b3 entc/gen: add example for uuid edge-field and fix #1723 (#1731) 2021-07-16 22:33:28 +03:00
Ariel Mashraki
d3a0b89864 entc/gen: simplify the way to get gen.Field operation
External templates should not deal with storage configuration
2021-06-27 11:07:38 +03:00
Ariel Mashraki
c40ae45aee entc/gen: add support for summing custom Go numeric types 2021-06-25 17:30:17 +03:00
Ariel Mashraki
754b56856a entc/gen: disallow immutable edge-fields
Until we add the immutable option for edges
2021-06-16 22:19:53 +03:00
Ariel Mashraki
66871c9806 dialect/sql/schema: add support for index prefixes in mysql 2021-06-09 22:52:31 +03:00
Mahmudul Haque
ba954ebeec dialect/sql/schema: add field collation support (#1548)
* specific field collation support

* go generate ./...
2021-05-09 18:09:08 +03:00
Vojtěch Káně
43ef74b8a8 entc/gen: add support for default annotation to PKs as well (#1492) 2021-04-22 14:16:53 +03:00
Ariel Mashraki
91dda6230f entc/gen: allow simple types to implement valuescanner 2021-04-20 14:44:31 +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
30c947546f entc: add global annotations option 2021-04-11 13:58:10 +03:00
Ariel Mashraki
8d7bb7fad6 entc/gen: check edge-field on mutation-cleared calls for edges
Fixed #1445
2021-04-10 14:56:34 +03:00
Ariel Mashraki
9090c103be entc/gen: add edge method for getting mutation-remove in templates 2021-04-08 15:56:11 +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
745afde770 dialect/entsql: add support for column default using annotation
Fixed #1033
2021-04-03 21:53:56 +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
3a64e2d20d entc/gen: use edge.owner for checking fk field (#1293)
See issue 1288
2021-03-02 17:42:52 +02:00
Ariel Mashraki
73df26b92b entc/gen: allow setting default-func for id fields (#1290) 2021-03-02 11:41:23 +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
15af025dd0 entc/gen: reject schemas whose package conflicts with ent predeclared identifiers (#1244) 2021-02-06 16:17:52 +02:00
Nathaniel Peiffer
96ebbcd627 fix: check names against privateFields (#1239) 2021-02-05 11:49:42 +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
Pavel Kerbel
8ca9d55b31 load/schema: added comment to generated schema (#1205) 2021-01-24 22:02:33 +02:00
Ariel Mashraki
97c316b80a entc/gen: move mutation-set naming to go api (#1123) 2021-01-03 22:10:19 +02:00
Nathaniel Peiffer
cfefd26543 cmd/internal/base: add name conflict check for init command (#1110)
* adds checks for name conflicts
also tidies up error handling inside init

* fix failing test, check for lower name for golang idents

* update function name and prefer builtin function

* pkg instead of lowerName
2021-01-02 22:25:39 +02:00
Noah-Jerome Lotzer
24f6975b9a schema/field: add default-func for bytes and strings (#1086) 2020-12-29 20:07:04 +02:00
Santi Aguilera
75d93200e9 dialect/sql/entsql: allow non incremental primary keys (#1074)
* Allow non incremental PKs

* Format code with gofmt

* Update entc/integration/config/config_test.go

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

* Update entc/integration/config/config_test.go

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

* Update entc/integration/config/config_test.go

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

* Update entc/integration/config/config_test.go

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

* Sort imports

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2020-12-28 17:34:27 +02:00
Nathaniel Peiffer
754e89c6ae entc/gen: add support for indexing id fields (#991)
* fix: allow indexes to be created on ID field

* test: add case for id field

* remove extraneous nil check

* change add primary method

* add integration test for mixin id

* go generate

* add default for default

* make linter happy

* invert if statement

* add default index to card integration test

* add index on default id, mixin id, and composite index

* go generate
2020-12-17 17:58:01 +02:00
Ariel Mashraki
be9955a860 entc/load: merge annotations from the same type 2020-12-13 19:16:54 +02:00
Ariel Mashraki
70f2b1355a entc/gen: expose edge mutation setters for external templates (#1032) 2020-12-12 00:01:30 +02:00
Ariel Mashraki
deb368933f entc/gen: add withFKs to reserved fields 2020-12-09 18:29:49 +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
Ariel Mashraki
68f40030a6 entc/gen: improve validator-check error for gotype (#970) 2020-11-21 17:07:54 +02:00
Harold.Luo
b71fc2714b dialect/entsql: add Size to Annotation (#947) 2020-11-13 20:44:42 +02:00
Ariel Mashraki
3038bb5ab1 entc/gen: add an api for getting the entsql annotation for field (#942) 2020-11-12 16:29:53 +02:00
Ariel Mashraki
dea48a78ea entc/gen: merge list of entsql annotation to one (#928) 2020-11-08 10:57:31 +02:00
Target Liu
d993b59d90 fix: pk forces the Type of the numeric to be TypeInt so that the user defined id type is invalid (#926) 2020-11-07 18:51:50 +02:00
Steven Imle
3abb2726d0 entc/gen: ensure edges are able to use Go keywords as storage-keys (#922) 2020-11-05 18:26:43 +02:00
Ariel Mashraki
fb97ca66ac entc/gen: move eager-loading naming to Go api (#887) 2020-10-27 20:11:59 +02:00
Ariel Mashraki
ed48f15429 dialect/entsql: add entsql annotation (#876) 2020-10-23 16:39:58 +03:00
Prem Saraswat
18e46c5648 fix naming conflict for 'Client' (#874) 2020-10-22 07:54:03 +03:00
Ariel Mashraki
7635d45c8a entc/gen: reject codegen in case of duplicate edges (#858)
See #856
2020-10-16 14:04:52 +03:00
Ariel Mashraki
85c4999472 ent: add annotations to type schema 2020-10-12 13:06:25 +03:00
Ariel Mashraki
fae1956828 entql: add typed-builder for field predicates 2020-10-11 14:41:03 +03:00
Ariel Mashraki
48362e79cd entc/gen: derive the id-type from the schema (#823)
if it was not provided
2020-10-06 16:29:09 +03:00