Ariel Mashraki
963bd669fd
dialect/sql: add example to SIMILAR TO predicate ( #2055 )
2021-10-21 12:01:58 +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
899e9f0e50
dialect/sql: wraps the sql.Rows with ColumnScanner interface
2021-10-14 09:32:30 +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
f30a17edd4
all: fix linting issues before migrating to golangci v1.42 ( #2019 )
2021-10-07 19:54:43 +03:00
Shen Yang
65cf307b10
dialect/sql/schema: add support for tstzrange and interval and in postgres ( #2013 )
...
Fixes #1989
2021-10-06 21:46:34 +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
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
4c2faf2282
entc/gen: allow spaces in enum fields
2021-09-23 23:23:28 +03:00
storyicon
779594f7da
dialect/sql/schema: support mysql mediumtext type ( #1972 )
...
Signed-off-by: storyicon <yuanchao@bilibili.com >
2021-09-22 15:35:14 +03:00
Ariel Mashraki
5c7c36bf29
dialect/sql/schema: skip parsing expression default for postgres
...
Fixed https://github.com/ent/ent/issues/1962
2021-09-21 15:59:04 +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
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