Commit Graph

15 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Ariel Mashraki
930a17b767 dialect/sql: add neighbors function (#140)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/140

This part of the effort of moving logic from Go templates to shared packages.
Next diffs will migrate the neighbors-set and predicates as well.

Dedicated tests for `sql/dialect/graph.go` will be added in a follow-up diff.

Reviewed By: alexsn

Differential Revision: D18304531

fbshipit-source-id: 93e9cf2636b5b4525eb27305bd2708122cfd6e40
2019-11-05 13:08:48 -08:00