Commit Graph

418 Commits

Author SHA1 Message Date
Ariel Mashraki
cd366c07e2 dialect/sqlscan: add tests for nulltype scanning (#278) 2020-01-12 11:02:05 +02:00
Ariel Mashraki
b93958ebf4 dialect/sql/sqlgraph: add query edges function (#274) 2020-01-07 19:50:33 +02:00
Christoph Hartmann
46982d2f05 dialect/sql: add predicates for composite where query (#264)
* add predicates for composite where query

Signed-off-by: Christoph Hartmann <chris@lollyrock.com>

* use existing table.Columns method

* simplify the composite operator methods
2020-01-02 18:42:26 +02:00
Ariel Mashraki
7fc3689027 dialect/sql/schema: add prepare option to mysql dialect 2020-01-01 19:11:20 +02:00
Ariel Mashraki
ab732c7654 dialect/sql: add drop-fk command to builder 2019-12-31 21:26:02 +02:00
Ariel Mashraki
c09028f58b dialect/sql/sqlgraph: consistent scan names 2019-12-22 20:12:00 +02:00
Ariel Mashraki
a26b9626a6 entc/gen: move query-count to sqlgraph 2019-12-22 19:42:28 +02:00
Ariel Mashraki
d6d7ef565f dialect/sql/sqlgraph: minor grammar changes 2019-12-22 15:36:03 +02:00
Ariel Mashraki
7fde9b7642 entc/gen: move sql-update-one to sqlgraph 2019-12-22 13:32:51 +02:00
Ariel Mashraki
c6800a3869 entc/gen: move node creation to sqlgraph 2019-12-17 22:45:04 +02:00
Ariel Mashraki
0cc74b5297 all: move sqlgraph to its own package 2019-12-17 18:26:09 +02:00
Ariel Mashraki
6bb834612c dialect/sql/schema: drop unique constraint on pg migration
Fixes #235
2019-12-15 18:52:05 +02:00
Ariel Mashraki
58486009c2 dialect/sql/schema: keep the original name of pg index 2019-12-15 16:47:46 +02:00
Ariel Mashraki
25fe5b8f4a dialect/sql/schema: correctly check pg unique constraint 2019-12-15 16:41:28 +02:00
Ariel Mashraki
fb4e1b6234 dialect/sql/sqlgraph: add tests for nodes count 2019-12-12 17:22:36 +02:00
Ariel Mashraki
26ccecdf6d dialect/sql/sqlgraph: add initial work for nodes-count 2019-12-12 17:14:34 +02:00
Ariel Mashraki
4ab244cf93 dialect/sql/sqlgraph: first work on nodes querying 2019-12-12 12:56:31 +02:00
Ariel Mashraki
9f324ce030 dialect/sql/sqlgraph: delete nodes in the graph 2019-12-11 15:39:20 +02:00
Ariel Mashraki
429e331b32 dialect/sql/sqlgraph: add edge tests for nodes update 2019-12-11 14:41:27 +02:00
Ariel Mashraki
876e454d1e dialect/sql/sqlgraph: add rest of edges to update-nodes 2019-12-10 21:22:09 +02:00
Ariel Mashraki
f86e39f179 dialect/sql/sqlgraph: update nodes using predicate
Currently, only fields and own-FK.
Next PR will edge types: M2M, O2M and O2O (non-inverse).
2019-12-10 17:17:35 +02:00
Ariel Mashraki
f65cf5150e dialect/sqlscan: add interface{} scanning support
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/223

Reviewed By: alexsn

Differential Revision: D18878581

fbshipit-source-id: 4a60ceea6c092f065e52e6b3bb625487451a815d
2019-12-08 21:59:53 -08:00
Ariel Mashraki
0fb33aaa5e dialect/sql/sqlgraph: add update node api
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/222

Reviewed By: alexsn

Differential Revision: D18833733

fbshipit-source-id: e833d84f4e5e5c73b1c85e7387472c9a87b7947e
2019-12-08 21:59:53 -08:00
Ariel Mashraki
bb051603ac dialect/sqlgraph: add edges in node creation (#216)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/216

WIP - ignore for now

Reviewed By: alexsn

Differential Revision: D18795361

fbshipit-source-id: d3a4ef5562be5faf0837cad6364130ec203a9d37
2019-12-04 09:44:50 -08:00
Ariel Mashraki
a5e4a9cf54 dialect/sqlscan: add ScanInt64 to be used by sqlgraph
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/213

Reviewed By: alexsn

Differential Revision: D18763694

fbshipit-source-id: 890b35fcc2a28914b276ce65477788b4ddaeebf9
2019-12-03 01:44:48 -08:00
Ariel Mashraki
a4fac2db3b dialect/sqlgraph: initial work for create-node api (#211)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/211

Move out the logic from the Go templates to Go code.

Next diff will add the edges of the node.

Reviewed By: alexsn

Differential Revision: D18762049

fbshipit-source-id: c9a93672415a26a6f4a7d466e569b8b0e8b0f9ee
2019-12-02 08:12:13 -08:00
Ariel Mashraki
0f4fc12cc5 dialect/sql: support recursive pointer types
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/210

Reviewed By: alexsn

Differential Revision: D18757642

fbshipit-source-id: 6dec318f68e2f14f1c7ffdf2dcd185be130b2f77
2019-12-01 05:54:52 -08:00
Ariel Mashraki
80dab06a57 dialect/sql: match column scan with sql tag
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/209

Reviewed By: alexsn

Differential Revision: D18757390

fbshipit-source-id: 534a8404a06487d90f1f4f10b1f93c774bac2e97
2019-12-01 03:21:38 -08:00
Ariel Mashraki
f98dbbc440 dialect/sql/schema: remove Go 1.13 string features
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/207

Reviewed By: xjtian

Differential Revision: D18743529

fbshipit-source-id: f6420e9ca233e0ce6f9254b4f85d1711ee4d4bfa
2019-11-28 03:16:55 -08:00
Ariel Mashraki
5610d0ade9 dialect/sqlgraph: fix neighbors check with predicates
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/206

Reviewed By: alexsn

Differential Revision: D18729641

fbshipit-source-id: a5d333132ae276691ac8c1b084bc5d2037112529
2019-11-27 23:50:00 -08:00
Ariel Mashraki
29c7b0a0d8 dialect/sql: remove Go1.13 specific features
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/205

Reviewed By: alexsn

Differential Revision: D18742422

fbshipit-source-id: 1e1996fe26787788e4c0466a58884b4fa0581353
2019-11-27 23:14:24 -08:00
Ariel Mashraki
6fe565f059 dialect/sqlgraph: add builder with functional options for neighbors steps
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/199

Reviewed By: alexsn

Differential Revision: D18707950

fbshipit-source-id: 77e5308dc4f984306c131d8541cbbd60d82a1488
2019-11-26 12:42:47 -08:00
Ariel Mashraki
413bbad8d8 dialect/sqlgraph: fix M2O relation in neighbors-with check
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/198

Reviewed By: alexsn

Differential Revision: D18707741

fbshipit-source-id: 69dd010e27ee07ffe44acc12003b9772220aaa2a
2019-11-26 12:42:47 -08:00
Ariel Mashraki
be307dab3c dialect/sql: type alias txoptions
Reviewed By: alexsn

Differential Revision: D18689199

fbshipit-source-id: 7606a3a24beb286d464b64eb2e51a1257fbffdcd
2019-11-25 10:13:59 -08:00
Ariel Mashraki
1bf83dd65f dialect/sql: add BeginTx for sql driver
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/193

Reviewed By: dlvhdr

Differential Revision: D18685934

fbshipit-source-id: abc4bf0b14ece3827bc20ecb864e7ca0594c2759
2019-11-25 07:29:52 -08:00
Ariel Mashraki
d2fb1b5548 dialect/sql: override RETURNING clause on postgres
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/192

Reviewed By: dlvhdr

Differential Revision: D18685852

fbshipit-source-id: 90ddd1057a7d6cfa00470a7b11fb237862edcc2b
2019-11-25 07:29:52 -08:00
Ariel Mashraki
038dc2899a dialect/sqlgraph: test and fix M2M neighbors check
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/190

Reviewed By: alexsn

Differential Revision: D18680440

fbshipit-source-id: b2dce0ee3e0a898fab901c4287c6c1c1844e51d6
2019-11-24 22:34:28 -08:00
Ariel Mashraki
7fb6238d18 dialect/sql: add hasneighborswith for predicates
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/185

Reviewed By: alexsn

Differential Revision: D18661688

fbshipit-source-id: 4c60fa5e81372f10bfecf4f166b048784bc515ee
2019-11-24 07:11:22 -08:00
Ariel Mashraki
0fc310e600 sql/dialect/schema: ignore foreign-keys in index dropping
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/188

Reviewed By: alexsn

Differential Revision: D18676877

fbshipit-source-id: 0babe457edadfa46dcbc7c7478d4468c48f84361
2019-11-24 05:32:22 -08:00
Ariel Mashraki
2543d90167 dialect/sql: add hasneigbors for predicates (#184)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/184

This diff is part of the ongoing effort for moving the sql logic out from codegen.

Reviewed By: alexsn

Differential Revision: D18656817

fbshipit-source-id: 71001d37eb78032414c2f83f200d3011b50c114b
2019-11-24 04:16:36 -08:00
Ariel Mashraki
c355ed49be entc/gen: move set-neighbors logic from codegen to sqlgraph
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/183

Reviewed By: alexsn

Differential Revision: D18644179

fbshipit-source-id: 2f2b0c03811a09c4c11240e5161187afbb2ac553
2019-11-24 04:16:36 -08:00
Ariel Mashraki
e54373f410 ent: allow non-numeric columns as PKs
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/180

Reviewed By: alexsn

Differential Revision: D18636443

fbshipit-source-id: f14b34926817f6d9652f49a640bfb377f3f3cdaf
2019-11-21 08:49:58 -08:00
Ariel Mashraki
703a6dd039 dialect/sql/schema: mysql support for uuid type
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/176

Reviewed By: alexsn

Differential Revision: D18615992

fbshipit-source-id: 2c86a661e8d75165470b9b2d351cb973147290d8
2019-11-20 09:49:55 -08:00
Ariel Mashraki
f7dac21972 dialect/sql/schema: sqlite support for uuid type
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/177

Reviewed By: alexsn

Differential Revision: D18615595

fbshipit-source-id: b3167a0aa9260cdf22d88dd7e45c7ebfae1909d5
2019-11-20 09:49:55 -08:00
Ariel Mashraki
db7b05ad04 dialect/sql/schema: postgres support for uuid type
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/178

Reviewed By: alexsn

Differential Revision: D18615561

fbshipit-source-id: 8244189186bf35d78cfdb991ee4f8cecd6411cee
2019-11-20 09:49:54 -08:00
Ariel Mashraki
d31f0828f0 dialect/sql: replace nulltime with official implementation on 1.13 and higher
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/169

Reviewed By: alexsn

Differential Revision: D18561431

fbshipit-source-id: d21335c073e0abed99d97c85c03cfa17c8326fef
2019-11-17 09:06:58 -08:00
Ariel Mashraki
54b1a2ead9 sql/dialect/schema: accept old blob types in mysql (#164)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/164

support varbinary as blob types

Reviewed By: yhayun

Differential Revision: D18504189

fbshipit-source-id: e3c8fcf412d1f6374b0084b439eee426b24b3466
2019-11-14 06:37:17 -08:00
Ariel Mashraki
6ce4cb6803 all: fix minor lint errors
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/159

Reviewed By: dlvhdr

Differential Revision: D18476131

fbshipit-source-id: 9e792f5a35f25233aad73f75f12d13d215a21ad2
2019-11-13 06:01:41 -08:00
Ariel Mashraki
aece79f8a8 dialect/sql: add option for getting the neighbors of set of vertices (#157)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/157

It should be used by the query builders for stepping to neighbors of the matches.

Reviewed By: alexsn

Differential Revision: D18448517

fbshipit-source-id: bf3aeea8c90a4e9b090e9298a20600b8f0b5ace3
2019-11-12 10:37:23 -08:00
Ariel Mashraki
73e294a21e dialect/sql: reduce the number of joins on neighbors without predicates (#154)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/154

Loading the "form" table is not required where there's no predicate on the join.

Reviewed By: alexsn

Differential Revision: D18421062

fbshipit-source-id: cb2a045a5a8a76ea4f07e5cf4305a6da338a616e
2019-11-10 21:51:32 -08:00