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
Ariel Mashraki
38925b6134
dialect/sql/schema: revert #1547 for mariadb
2021-09-14 13:07:49 +03:00
Ariel Mashraki
0864659844
dialect/sql/sqlgraph: avoid creating tx blocks for single UPDATE statements
...
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 UpdateNodes operation with a single UPDATE statement.
Benchmark for 2000 operations was improved from:
7.98s 3992160 ns/op 4887 B/op 116 allocs/op
To:
4.42s 2209659 ns/op 4435 B/op 104 allocs/op
---
MySQL and SQLite share the same behavior. Please see #1858 for more info.
2021-09-11 08:56:37 +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
Ariel Mashraki
b23a0e8554
dialect/sql/sqlgraph: avoid creating tx blocks for single DELETE statements
...
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 DeleteNodes operation as it's implemented with a single statement.
Benchmark for 4000 operations was improved from:
14.54s 7270455 ns/op 3702 B/op 81 allocs/op
To:
5.36s 2679935 ns/op 2864 B/op 59 allocs/op
---
MySQL and SQLite share the same behavior. Please see https://github.com/ent/ent/pull/1858
for more info.
2021-08-27 16:02:29 +03:00
dakimura
dac5ccaec9
dialect/sql/schema: fix error message for the missing fk constraints ( #1861 )
2021-08-22 22:05:40 +03:00
Ariel Mashraki
ea67be12a4
dialect/sql/sqlgraph: avoid creating tx blocks for single statement create operation
...
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:
(2000 Inserts) 8.41s 4206748 ns/op 4595 B/op 115 allocs/op
To:
(2000 Inserts) 4.66s 2330222 ns/op 4107 B/op 104 allocs/op
2021-08-20 21:12:24 +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
Ariel Mashraki
397b3e984d
dialect/sql/schema: setup tables before execute hooks
2021-08-04 21:43:00 +03:00
Ariel Mashraki
09c4306378
entc/gen: add support for upsert/on-conflict feature-flag
2021-08-04 14:01:31 +03:00
Ariel Mashraki
16c4b3379b
sqlgraph: change modifiers to onconflict options
2021-08-01 18:43:59 +03:00
Ariel Mashraki
b19ac669c7
dialect/sql: override column values on Updater.Set
...
Avoid cases like 'SET a = 1, a = 2'.
2021-08-01 09:53:26 +03:00
Ariel Mashraki
7acf2234b6
dialect/sql/sqlgraph: allow setting stmt modifiers for create-many
2021-07-29 16:33:26 +03:00
Ariel Mashraki
b9fcbff724
dialect/sql/sqlgraph: allow setting stmt modifiers for create-one
2021-07-29 16:33:26 +03:00
Ariel Mashraki
b8f8ea0f06
dialect/sql: move onconflict clause to functional options
2021-07-28 12:49:11 +03:00
Ruben de Vries
1586d50f94
dialect/sql: do not call inner Scan for nil values in sql.NullScanner ( #1771 )
2021-07-27 12:05:22 +03:00
Ariel Mashraki
9de519d027
dialect/sql: add expression function support
2021-07-27 11:36:56 +03:00
Andrey Elenskiy
20b616768d
dialect/sql: return selector's alias as a table name ( #1745 )
...
In case selector's from clause has *Selector instead of *SelectTable,
TableName() function (used for column checking) will panic.
Instead, return selector's alias which is useful if the query returns
a table with the same schema as some entity. Essentially, this allows
materialized views to reuse the same entity code as long as columns
are matching.
2021-07-25 22:14:32 +03:00
Khadija Sidhpuri
364ab46333
dialect/sql: append UNION before ORDER BY ( #1761 )
...
* fix: builder to append UNION before ORDER_BY
* gofmt builder_test.go
2021-07-22 23:33:34 +03:00
Ariel Mashraki
6a7b3c8e7a
entc/gen: add feature-flag and implementation for sql/lock
...
Fixed #358
2021-07-21 11:50:06 +03:00
Ariel Mashraki
279d6c2a12
dialect/sql/sqlgraph: add support for query modifiers
2021-07-20 13:14:39 +03:00
Tony Griezmann
201c7301aa
dialect/sql/schema: support for USING method in create index builder ( #1730 )
...
* Support for USING 'method' in create index
* Add USING 'method' in create index support for MySQL
* Fix USING 'method' for MySQL to be a raw string
2021-07-19 15:21:35 +03:00
Ariel Mashraki
79716e47d0
dialect/sql/schema: remove unneeded nolint rule
2021-07-16 14:07:40 +03:00
Ruben de Vries
1ea718f7bf
dialect/sql/schema: add support for postgres and mysql numeric and decimal types in migrations ( #1721 )
...
* improve error message when failing to generate changeset
* support migrations for postgres and mysql numeric fields
2021-07-16 13:57:53 +03:00
Ariel Mashraki
99a9d6cf9b
dialect/sql: introduce lock config options
2021-07-08 16:41:01 +03:00
bshihr
4066255641
dialect/sql/schema: add IndexBuilder.IfNotExists and use for Create() case. ( #1666 )
...
Append-only mode creates tables with the `IF NOT EXISTS` annotation.
Make indices case symmetric with this.
2021-06-30 09:09:48 +03:00
Ariel Mashraki
7ffdce4cef
sql/schema: support custom char type for field.Other
...
Fixed #1664
2021-06-29 16:31:57 +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
1d661deb50
dialect/sql/schema: add mysql tests for checks annotation
2021-06-18 10:30:07 +03:00
Ariel Mashraki
42a2c67cc4
dialect/entsql: add support for table checks in schema/migration
2021-06-17 23:22:37 +03:00
Ariel Mashraki
b8f4614bfd
dialect/sql: allow adding check clauses in create table
2021-06-17 22:30:15 +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
7428167a14
dialect/sql/schema: add testcase for unsigned decimal types ( #1628 )
2021-06-08 11:22:55 +03:00
WzyJerry
bbe54ede4e
dialect/sql/sqljson: query in array of objects with Postgres backend #1594 ( #1621 )
2021-06-03 08:56:58 +03:00
Ariel Mashraki
f5c284787f
dialect/sql: allow appending select columns to query
2021-06-01 11:50:16 +03:00
Ariel Mashraki
69c4e2387e
dialect/sql: add (not)exists predicate for builder
2021-05-27 21:56:56 +03:00
Ariel Mashraki
961dc08d14
examples/fs: add example for recursive traversals ( #1599 )
2021-05-25 20:45:37 +03:00
Ariel Mashraki
02452aad89
dialect/sql: add option to prefix select queries ( #1598 )
2021-05-25 18:38:06 +03:00
Ariel Mashraki
5d3cc575b3
dialect/sql: add union and with-recursive api for builder ( #1595 )
2021-05-25 18:27:32 +03:00
Ariel Mashraki
b46a6f0d69
dialect/sql/sqlgraph: prefix entql idents with table/select name ( #1592 )
2021-05-23 18:12:16 +03:00
Benjamin Bourgeais
d114942589
dialect/sql: improve equalfold implementation ( #1572 )
2021-05-19 22:30:50 +03:00
Ariel Mashraki
f7db15ccbb
dialect/sql/schema: add field collation support for postgres
2021-05-10 20:32:45 +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
Ariel Mashraki
37d4b9e2cb
dialect/sql/schema: do not set timestamp to nullable columns on MySQLv8.* ( #1547 )
...
Fixed #1541
2021-05-08 21:29:35 +03:00
陈杨文
be59ad6d3f
dialect.sql/schema.Column ScanDefault allowed uuid default to function ( #1537 )
2021-05-07 16:15:29 +03:00
陈杨文
6d3df1469c
dialect/sql: include nested builder errors on join ( #1533 )
...
* sql.Builder Join include Querier's error
* sql.Builder Join ignore nil error
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com >
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com >
2021-05-05 17:09:55 +03:00
AlonDavidBehr
110bfd97ca
dialect/sql/schema: fixed spelling mistakes in schema.go ( #1532 )
2021-05-03 21:02:52 +03:00