Commit Graph

680 Commits

Author SHA1 Message Date
Ariel Mashraki
1c263c7abd dialect/sql: add support for SelectExpr (#2220) 2021-12-16 13:50:03 +02:00
MasseElch
76770e8a52 entc/gen: don't rely on descriptor when retrieving enum values or names to ease extension testibility (#2211)
Trying to add tests to some extensions and this is complicating things a lot because `Field.def` is unexported. Not taking the length of `def.Enums` but `Enums` directly fixes this. It technically is also more correct, because `f.Enums` could be greater than `f.def.Enums`.
2021-12-11 14:25:02 +02:00
Ariel Mashraki
fd3b29f785 entc/gen: import gen.Config documentation (#2189) 2021-12-01 14:41:55 +02:00
Ariel Mashraki
d432d880c7 entc/load: add go module info to schema spec (#2175) 2021-12-01 11:30:38 +02:00
Ariel Mashraki
6372263b99 entc/gen: add support for subtracting values from unsgined fields (#2169) 2021-11-25 12:37:43 +02:00
Andy Day
b1e76d1a05 entc/gen: fix entql generation for ID types of Bytes, etc. (#2157)
* Fix entql generation for ID types of Bytes, etc.

I was running into an issue trying to use a Bytes fieldas the ID field in a Schema, and it appears there is an currently an issue with using a Bytes field as the ID field in the entql codegen (it was outputing a function . I belive this should fix it (I tested this by adding the entql flag to the custom id integration test). I wasn't sure if the other cases I added (e.g. an ID field that is json type / time type / etc.) are actually sane ID field types, but if those don't make any sense I can remove some of those from the added conditionals.

* remove redundant line
2021-11-24 13:53:45 +02:00
Ariel Mashraki
9e74510c09 entc/integration: minor changes for test cases (#2148) 2021-11-19 15:38:49 +02:00
Ariel Mashraki
6402fc7fe2 Merge pull request #2137 from ent/getoutreach-grevych/sqljson-pattern-matching-predicates
Getoutreach grevych/sqljson pattern matching predicates
2021-11-16 10:21:08 +02:00
Ariel Mashraki
77701d4db6 dialect/sql/sqljson: use the builtin string predciates in sqljson and improve tests 2021-11-16 10:07:34 +02:00
Ariel Mashraki
a5fea077a9 dialect/sql: use identifier qualifiers for WHERE clause on upsert
Fixed https://github.com/ent/ent/issues/2126
2021-11-12 23:46:46 +02:00
Ariel Mashraki
0dd7b0d7c3 dialect/sql/sqljson: fix sqlite haskey and add docs 2021-11-11 18:58:28 +02:00
Ariel Mashraki
3ba2b4e173 entc/integration/json: add tests for null literals 2021-11-10 17:24:51 +02:00
Ariel Mashraki
ab207c499a entc/gen: minor codegen improvements 2021-11-08 15:56:15 +02:00
Ariel Mashraki
e915765f3b entc/gen: allow scanning nil valuescanner types directly from database
Fixed https://github.com/ent/ent/issues/2116
2021-11-07 23:09:02 +02:00
Ariel Mashraki
dd6c034c2a dialect/sql/schema: support mediumtext field in migration
Fixed https://github.com/ent/ent/issues/2113
2021-11-07 15:37:06 +02:00
Ariel Mashraki
caa673826a entc/gen/mutation: add IDs method for mutations 2021-11-03 23:16:56 +02:00
Alexander Melentyev
147b1f59ae all: small typo fixes (#2095) 2021-11-01 17:47:06 +02:00
Alexander Melentyev
681d03e896 entc/gen: fix DependencyName godoc (#2094) 2021-10-30 22:51:15 +03: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
Alexander Melentyev
56016d56d6 entc/gen: remove unused named return (#2069) 2021-10-27 12:37:47 +03:00
Ariel Mashraki
82eeeb5a1c entc/gen: introduce the entc.Dependency option 2021-10-26 20:33:04 +03:00
Ariel Mashraki
a1f6de2793 dialect/sql: escape special characters in pattern matching
Resources:
- https://www.postgresql.org/docs/current/functions-matching.html\#FUNCTIONS-LIKE
- https://www.sqlite.org/lang_expr.html\#the_like_glob_regexp_and_match_operators
- https://dev.mysql.com/doc/refman/8.0/en/string-literals.html

Fixed https://github.com/ent/ent/issues/2059
2021-10-24 21:14:26 +03:00
Ariel Mashraki
e687246f7a schema/field: support default values for json and other 2021-10-21 22:57:04 +03:00
Ariel Mashraki
aa8d2ecb58 entc/gen/integ: add example for using query modifiers in multischema mode 2021-10-18 18:52:44 +03:00
Ariel Mashraki
3e6c40886d entc/gen: support count with field selection
Fixed https://github.com/ent/ent/issues/2036
2021-10-17 19:03:49 +03:00
Ariel Mashraki
123930c362 entc/integ: add example for o2o with edge field 2021-10-12 20:54:23 +03:00
mook
076e1269e8 entc/gen: fix example code in comment (#2025) 2021-10-12 10:29:58 +03:00
sivchari
eee77df5a6 entc/integration/template: fix go vet errors (#2021)
* fix govet

* fix template and receiver argument
2021-10-11 13:38:45 +03:00
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
e2df06503d entc/integration: add postgres14 for integration/ci tests (#2006) 2021-10-04 17:34:12 +03:00
Ariel Mashraki
14cba0abb6 dialect/sql/schema: make Field.Unique and Index.Unique equal (#2004)
This will allow moving from:

	field.String(c).Unique()

To:

	index.Field(c).Unique()

And vice versa
2021-10-03 16:20:28 +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
4306643d16 dialect/sql/sqlgraph: support sql.Scanner types when scanning IDs (#1987)
Fixed https://github.com/ent/ent/issues/1985
2021-09-27 17:49:57 +03:00
Evan Lurvey
300f0b5307 schema/field: add the Sensitive option to field.Bytes (#1982)
* Add Sensitive() option to bytesBuilder

I have a use case where I want to store bytes but I want to use the sensitive option.

* Added new field test and ran generation

Co-authored-by: Evan Lurvey <elurvey@Evans-Mac-mini.local>
2021-09-25 23:21:55 +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
5262810d8c entc/integ: move docker-compose to top directory 2021-09-22 17:06:06 +03:00
Ariel Mashraki
4314b3a9e8 entc/gen: add test cases for unique field selection 2021-09-21 20:31:03 +03:00
Ariel Mashraki
ac05c1357e examples: run codegen for examples 2021-09-21 20:25:08 +03:00
EndlessIdea
bfc0e7c575 go generate 2021-09-18 16:32:33 +08:00
Lining Guan
f42014f019 enable distinct in sqlQuery 2021-09-18 16:01:11 +08:00
Ariel Mashraki
5f31091dcd entc/gen: support de/incrementing values on upsert
Fixed https://github.com/ent/ent/issues/1952.
2021-09-17 14:25:34 +03:00
Tarrence van As
f903c3a371 entc/gen: fix fk handling for bytes (#1947) 2021-09-14 22:42:48 +03:00
Ariel Mashraki
c1fae17b6c entc/gen: add schema type to generated validation errors 2021-09-07 18:33:32 +03:00
Emmanuel T Odeke
9904bcb8c8 all: add (*testing.B).ReportAllocs() to all benchmarks (#1919)
This allows a full picture when continuous benchmarking
is added to this repository and when any changes are made
to the code in here.

Fixes #1918
2021-09-07 17:04:07 +03:00
seiichi
5277780598 entc/integration: change gremlin server version to v3.4.11 #1807 (#1808) 2021-09-02 09:07:14 +03:00
Risky Feryansyah
65938ccdd3 entc/integration: change Save to Exec in create operation when model is not needed (#1896)
* refactor(entc/integration): change Save to Exec in create operation

* fix: should not change to exec if we need return of the data
2021-09-01 10:05:30 +03:00
Risky Feryansyah
9fb76ef5c5 entc/integration: change Save to Exec in create operation (#1891) 2021-08-31 13:09:08 +03:00
Ariel Mashraki
e545d0db7a entc/integ: test adding filters to UpdateOne from mutation 2021-08-30 15:21:16 +03:00