Commit Graph

100 Commits

Author SHA1 Message Date
Ariel Mashraki
7064e58744 dialect/sql/sqlgraph: replace IN with EXISTS in HasNeighbors/With predicates (#4060) 2024-05-19 12:31:07 +03:00
JSH
1bcb2fa9cc dialect/sql/sqlgraph: allow scanning non-numeric IDs in batch creations (#3830)
* Use same logic between lastInsertId & lastInsertIds

* fix for bulkcreator.insertLastIds
2024-01-03 23:34:23 +02:00
Michael Caulley
ffe0aa8ac7 fix: swap the order of handling order and pred in the graph select func (#3841)
multi order may generate predicates, so running the order funcs first allows reusing aliases
2023-11-23 19:01:24 +02:00
Luc van Kessel
d8774635e6 dialect/sql/sqlgraph: support nil errors in constraint checks (#3701)
* added nil checks to constraint errors

* removed whitespace from nil error checks

---------

Co-authored-by: Luc van Kessel <luc@klippa.com>
2023-08-18 22:13:38 +03:00
Ariel Mashraki
b49d5f5924 dialect/sql/sqlgraph: expose standard modifier to eager-load N neighbors (#3603) 2023-06-17 12:23:57 +03:00
Ariel Mashraki
bc7d8c936f dialect/sql/sqlgraph: replace id IN with EXISTS for HasNeighbors predicates (#3492) 2023-04-19 17:52:01 +03:00
Ariel Mashraki
8cb27bc7cf dialect/sql: add method for finding selection occurrences in queries (#3473) 2023-04-12 23:22:52 +03:00
Ariel Mashraki
44b8648720 dialect/sql/sqlgraph: allow query edge fields with alias (#3470) 2023-04-11 13:55:04 +03:00
Ariel Mashraki
064c9118b7 entc/gen: add fluent-api for order options (#3449) 2023-04-09 10:37:42 +03:00
Ariel Mashraki
02bb3269af dialect/sql: move order-by options to top-level driver package (#3446) 2023-04-07 00:35:20 +03:00
Ariel Mashraki
0e7203655e dialect/sql/sqlgraph: allow selecting order by terms (#3439) 2023-04-04 14:00:35 +03:00
Ariel Mashraki
ba7f158a9c entc/gen: allow scanning dynamic sql values (#3432) 2023-04-03 17:07:24 +03:00
Ariel Mashraki
27bc0470eb dialect/sql/sqlgraph: add Step helpers for edge types (#3428) 2023-04-01 21:34:42 +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
d9e7adfa05 dialect/sql/sqlgraph: catch SQLite INSERT errors executed with Driver.Query (#3415) 2023-03-27 22:21:47 +03:00
Ariel Mashraki
c35f786f86 entc/gen: ensure edge-fields are selected when their edges are loaded (#3401) 2023-03-20 19:11:04 +02:00
Ariel Mashraki
939c7cff1a entc/gen: reduce the usage of DISTINCT in queries (#3305)
Most queries are not graph traversals but rather regular table scans,
in which case the DISTINCT clause is not needed as duplicates cannot be
returned (unless query was modified by the user).
2023-02-06 22:40:50 +02:00
Ariel Mashraki
8022271f12 entc/integration: add example for composite unique index (#3302) 2023-02-06 11:17:33 +02:00
Ariel Mashraki
0e6ef32505 dialect/sql/sqlgraph: add update spec builder (#3301) 2023-02-06 07:13:06 +02:00
Ariel Mashraki
92cc7438f7 dialect/sql/sqlgraph: add deletion spec builder (#3291) 2023-02-01 11:55:00 +02:00
Ariel Mashraki
037b5a4bc3 dialect/sql/sqlgraph: add builders to create spec (#3288) 2023-01-31 09:37:51 +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
b88f45aa78 entc/gen: skip executing sub-query for empty set of edges (#3212) 2023-01-07 08:54:18 +02:00
Ariel Mashraki
f46dd7ace8 dialect/sql/sqlgraph: add support for edge-schema in create-bulk 2022-11-20 17:37:08 +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
35d0d4c3db dialect/sql/sqlgraph: handle edge-schema in M2O/O2Oi calls entql 2022-11-01 19:46:33 +02:00
Ariel Mashraki
a8dde5e0d1 dialect/sql/sqlgraph: move fields setters to method calls (#2995) 2022-10-08 20:08:22 +03:00
Ariel Mashraki
13bf27bdd6 entc/gen: support Append<F> for JSON array fields (#2975) 2022-09-29 16:57:54 +03:00
Ariel Mashraki
2969796669 dialect/sql/sqlgraph: support batch-upadte for edge-schemas (#2897) 2022-09-02 15:33:41 +03:00
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +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
0fd641333c dialect/sql/sqlgraph: support custom modifiers in UPDATE commands 2022-08-05 14:42:04 +03:00
Ariel Mashraki
26e07c90c0 dialect/sql/sqlgraph: support edgeschema in entgql (#2817) 2022-08-01 18:18:12 +03:00
Ariel Mashraki
ba582c83b3 entc/gen: improve edge-schema updates (#2726)
Also, added additional example where an edge schema has another edge
to a type that holds an information about the relationship.

The only reason this example exists is to allow users to reduce the storage
occupied by the join-table and allow connect (via M2O) multiple edge-schemas
to an 'information'/'description' node.
2022-07-07 07:34:17 +03:00
Ariel Mashraki
8c55008a9d dialect/sql/sqlgraph: handle edge schema in batch inserts (#2718) 2022-07-05 14:15:31 +03:00
Ariel Mashraki
ed783dba70 dialect/sql/sqlgraph: support edge-schema in upsert (#2714) 2022-07-03 23:29:35 +03:00
Ariel Mashraki
abefaa7f24 entc/gen: catch constraint failures in delete operations (#2664) 2022-06-19 14:34:32 +03:00
Ariel Mashraki
5b81d7d832 dialect/sql/sqlgraph: better support for update nodes with predicates (#2574) 2022-05-29 16:23:52 +03:00
Ariel Mashraki
e1c5277483 ent: initial support for edge schemas (#2560) 2022-05-25 15:46:00 +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
b70754d12f dialect/sql/sqlgraph: avoid creating tx blocks for single statement batch-create operation (#2272)
For example, in PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction
blocks manually (group of statements surrounded by BEGIN and COMMIT) for CreateNode operation with single SQL statement.

Benchmark was improved from:

	(4000 BatchInserts)    17.16s      4289178 ns/op  412893 B/op   4913 allocs/op

To:

	(4000 BatchInserts)   9.16s      2288807 ns/op  412142 B/op   4899 allocs/op
2022-01-15 23:04:37 +02:00
Ariel Mashraki
8f88f58713 dialect/sql/sqlgraph: minor refactor changes 2021-11-07 14:01:54 +02:00
Ariel Mashraki
02203c3f91 dialect/sqltest: ensure predicates can be reused 2021-11-02 23:01:11 +02:00
Andrey Elenskiy
62d64f2b78 dialect/sql/sqlgraph: use selector's column instead of table's column in HasNeighbors (#2060)
Allows for HasNeighbors' selector to be a generic selector instead of *SelectTable.
A use case for this is doing HasNeighbors* function on materialized queries instead
of on concrete tables only.
2021-10-25 07:46:54 +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
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
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
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