Commit Graph

151 Commits

Author SHA1 Message Date
Ariel Mashraki
36cd6a8a8b dialect/sql: skip formatting qualified columns (#3469) 2023-04-11 13:16:40 +03:00
Ariel Mashraki
064c9118b7 entc/gen: add fluent-api for order options (#3449) 2023-04-09 10:37:42 +03:00
Ariel Mashraki
4c332f7bba doc/features: add dynamic values support (#3436) 2023-04-03 17:55:28 +03:00
Ariel Mashraki
60bb939fc2 dialect/sql/sqlgraph: add function to order by edge terms (#3426) 2023-04-01 20:55:00 +03:00
Zhizhen He
6f847a3492 ci: add spell checker and fix existing typo (#3420)
* ci: add spell checker and fix existing typo

* chore: move typos.toml to .github

* fix: correct config file path
2023-03-30 11:38:29 +03:00
Ariel Mashraki
e3cee0adc2 dialect/sql/sqlgraph: add function to order by edge count (#3422) 2023-03-30 10:10:59 +03:00
Ariel Mashraki
651a2a166e dialect/sql: add Joined<T> helpers for Selector to avoid double joining (#3419) 2023-03-28 15:33:21 +03:00
Ariel Mashraki
427aaf7d45 dialect/sql: add Selector.HasJoins helper (#3418) 2023-03-28 14:31:43 +03:00
Ariel Mashraki
b340ed78cf dialect/sql: append selector alias only if defined (#3399) 2023-03-19 12:07:41 +02:00
Ariel Mashraki
3f1063c77e schema/field: add support or external ValueScanner (#3391) 2023-03-16 22:18:54 +02:00
Ariel Mashraki
8022271f12 entc/integration: add example for composite unique index (#3302) 2023-02-06 11:17:33 +02:00
Ariel Mashraki
433609444c dialect/sql/sqljson: support for order by value and length (#3278) 2023-01-26 12:20:31 +02:00
Pedro Henrique
604c4942a4 dialect/sql: improve support for subqueries (#3274) 2023-01-26 09:43:07 +02:00
Ariel Mashraki
fa1cf83fdd dialect/sql/sqlgraph: ignore ORDER BY clauses in COUNT queries (#3226) 2023-01-10 14:03:29 +02:00
Ariel Mashraki
f226627d67 ent: export query interceptors (#3157) 2022-12-19 10:17:10 +02:00
Ariel Mashraki
122574376b dialect/sql: add except and intersect to builder (#3127)
* dialect/sql: add except and intersect for builder

* dialect/sql: report an error in case INTERSECT/EXCEPT ALL were set in SQLite

Co-authored-by: Liooo <ryoyamada3@gmail.com>
2022-11-28 14:54:59 +02:00
cheny-alf
2840921231 dialect/sql: fix escape issue occurred in fuzzy testing (#3115)
* fix(builder):fix escape method

* fix(builder):fix escape method

Co-authored-by: chenfuqing <chenfuqing@laiye.com>
2022-11-26 13:26:14 +02:00
Ariel Mashraki
aa3d21f01a dialect/sql/sqlgraph: changing the M2M creation semantic from Add to Connect
Thus, calling AddE with the same edge values, ignore and not throw an error.
For edge-schemas with extra fields, we maintain the same logic because we cannot
determine if the extra fields have different values that what exist in the database
2022-11-20 17:37:08 +02:00
Ariel Mashraki
8d40edf24b dialect/sql: add support for LIMIT in update statement (#3018) 2022-10-17 10:02:53 +03:00
Ariel Mashraki
bbdfea319d dialect/sql: support the RETURNING clause in UPDATE (#3016)
* dialect/sql: support the RETURNING clause in UPDATE
2022-10-16 17:55:01 +03:00
Andrey Elenskiy
fe4b19a355 dialect/sql: add Window function to be able to customize function clause for window statements (#2994) 2022-10-11 23:45:49 +03:00
Ariel Mashraki
cf137c665a dialect/sql/sqljson: cast marshaled args as json (#3008) 2022-10-11 14:15:01 +03:00
Ariel Mashraki
eb4ea68356 dialect/sql/sqljson: add dialect-aware Append function 2022-09-29 08:54:44 +03:00
Ariel Mashraki
0adfb94c30 dialect/sql: support defining multiple FROM in query (#2933) 2022-09-16 00:10:11 +03:00
Ariel Mashraki
1773fc465e dialect/sql: add support for statement prefix in update builder (#2904) 2022-09-06 17:34:53 +03:00
Ryo Yamada
015effdcc1 dialect/sql/builder: added FullJoin (#2885)
* dialect/sql/builder: added FullJoin

* fix comment casing

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

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-08-30 07:39:35 +03:00
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +03:00
Pedro Henrique
2b54aadcce dialect/sql: escape EqualFold on Postgres (#2860)
* adds tests for equalFold predicates

* ensure EqualFold escapes the argument on Postgres

* adds tests on builder as well
2022-08-16 10:09:06 +03:00
Ariel Mashraki
94b19ac973 dialect/sql: use raw NULL value in statements rather than passing nil arguments 2022-08-14 11:10:36 +03:00
Ariel Mashraki
9f481d8716 dialect/sql: support setting ORDER BY for UPDATE statements 2022-08-05 14:42:04 +03:00
Andy Day
8beaef87ba dialect/sql/builder: make sql.NotIn() with empty args fallback to NOT FALSE (#2757)
* dialect/sql/builder: make sql.NotIn() with empty args fallback to False()

This is basically the identical change to #2735, but for NotIn().

This bug currently prevents anyone using NotIn() from upgrading from v0.10.x to v0.11.x

* Update go.sum

untidy

* feedback
2022-07-19 06:36:39 +03:00
Ariel Mashraki
6c8a1308ec entc/gen: edge schema with custom ids (#2742)
Fixed https://github.com/ent/ent/issues/2740
Fixed https://github.com/ent/ent/issues/2741
2022-07-12 18:13:45 +03:00
Ryo Yamada
b00e549c88 dialect/sql: make sql.In() with empty args fallback to False() (#2735)
* dialect/sql/builder: make sql.In() with empty args fallback to False()

* fix indent

* added comment

* remove the equilvalent logic in the codegen side

* comment fix, run go generate
2022-07-12 00:15:36 +03:00
Pedro Henrique
4d1c0af20d entc/integration: add examples for sub-queries + minor fixed for selector builder (#2509)
* dialect/sql: move FROM to inside switch

* dialect/sql: adds simple example of subquery usage

* dialect/sql: adds a more complex example with join

* Apply suggestions from code review

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

* dialect/sql: fix missing type and change modify to where

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-05-05 22:46:13 +03:00
Carlos González
5dd5acc08d dialect/sql: fixed a small typo in docs (#2459) 2022-04-07 19:54:43 +03:00
Ariel Mashraki
345d3d1783 dialect/sql: support for order by expressions in window functions (#2442) 2022-04-01 21:31:00 +03:00
Ariel Mashraki
92ff734815 dialect/sql: add support for window functions (#2431) 2022-03-27 20:53:36 +03:00
Ariel Mashraki
412947d274 dialect/sql: avoid passing bool arguments on bool predicates (#2405) 2022-03-15 22:52:49 +02:00
Ariel Mashraki
deb63d0292 dialect/sql: support passing selectors to basic predicates
Closed https://github.com/ent/ent/issues/2236
2021-12-25 15:02:49 +02:00
Ariel Mashraki
1c263c7abd dialect/sql: add support for SelectExpr (#2220) 2021-12-16 13:50:03 +02:00
Ariel Mashraki
b99ce66f40 dialect/sql: calling Update.Add after Update.Set should append expression (#2168) 2021-11-25 12:03:12 +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
Alexander Melentyev
147b1f59ae all: small typo fixes (#2095) 2021-11-01 17:47:06 +02: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
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
Ariel Mashraki
912415e1e1 dialect/sql: add Add method to UpdateSet 2021-09-16 23:41:29 +03:00
Ariel Mashraki
3c650e507e dialect/sql: use raw 0 in COALESCE function on Add calls
The second argument for COALESCE function is not a dynamic argument (always 0).
2021-09-16 23:07:45 +03:00
Rotem Tamir
f326c7dfd0 dialect/sql: report explicit error when trying to SELECT .. FOR UPDAT… (#1847)
* dialect/sql: report explicit error when trying to SELECT .. FOR UPDATE with sqlite

* remove redundant assertion
2021-08-17 12:54:23 +03:00
Ariel Mashraki
b8532f87a6 entc/gen: support for upsert with client generated ids
Fixed #1826
2021-08-14 17:44:04 +03:00
Ariel Mashraki
e71ccc6b6e dialect/sql/sqlgraph: fix bug in entql predicate evaluation (#1827) 2021-08-11 21:03:52 +03:00