1+ mod action;
2+ pub ( crate ) use action:: Action ;
3+
14mod delete_by_key;
5+ pub ( crate ) use delete_by_key:: DeleteByKey ;
6+
27mod exec_statement;
8+ pub ( crate ) use exec_statement:: { ExecStatement , ExecStatementOutput } ;
9+
310mod filter;
11+ pub ( crate ) use filter:: Filter ;
12+
413mod find_pk_by_index;
14+ pub ( crate ) use find_pk_by_index:: FindPkByIndex ;
15+
516mod get_by_key;
17+ pub ( crate ) use get_by_key:: GetByKey ;
18+
619mod nested_merge;
20+ pub ( crate ) use nested_merge:: { MergeQualification , NestedChild , NestedLevel , NestedMerge } ;
21+
22+ mod output;
23+ pub ( crate ) use output:: Output ;
24+
25+ mod plan;
26+ pub ( crate ) use plan:: ExecPlan ;
27+
728mod project;
29+ pub ( crate ) use project:: Project ;
30+
831mod query_pk;
32+ pub ( crate ) use query_pk:: QueryPk ;
33+
934mod rmw;
35+ pub ( crate ) use rmw:: ReadModifyWrite ;
36+
1037mod set_var;
38+ pub ( crate ) use set_var:: SetVar ;
39+
1140mod update_by_key;
41+ pub ( crate ) use update_by_key:: UpdateByKey ;
1242
13- mod var_store ;
14- pub ( crate ) use var_store :: VarStore ;
43+ mod var ;
44+ pub ( crate ) use var :: { VarId , VarStore } ;
1545
16- use crate :: {
17- engine:: {
18- plan:: { self , Action , VarId } ,
19- Engine ,
20- } ,
21- Result ,
46+ use crate :: { engine:: Engine , Result } ;
47+ use toasty_core:: {
48+ driver:: Rows ,
49+ stmt:: { self , ValueStream } ,
2250} ;
23- use toasty_core:: stmt:: ValueStream ;
24- use toasty_core:: { driver:: Rows , stmt} ;
2551
2652struct Exec < ' a > {
2753 engine : & ' a Engine ,
2854 vars : VarStore ,
2955}
3056
3157impl Engine {
32- pub ( crate ) async fn exec_plan (
33- & self ,
34- pipeline : & plan:: Pipeline ,
35- vars : VarStore ,
36- ) -> Result < ValueStream > {
37- Exec { engine : self , vars } . exec_pipeline ( pipeline) . await
38- }
39- }
58+ pub ( crate ) async fn exec_plan ( & self , plan : ExecPlan ) -> Result < ValueStream > {
59+ let mut exec = Exec {
60+ engine : self ,
61+ vars : plan. vars ,
62+ } ;
4063
41- impl Exec < ' _ > {
42- async fn exec_pipeline ( & mut self , pipeline : & plan:: Pipeline ) -> Result < ValueStream > {
43- for step in & pipeline. actions {
44- self . exec_step ( step) . await ?;
64+ for step in & plan. actions {
65+ exec. exec_step ( step) . await ?;
4566 }
4667
47- Ok ( if let Some ( returning) = pipeline . returning {
48- match self . vars . load ( returning) . await ? {
68+ Ok ( if let Some ( returning) = plan . returning {
69+ match exec . vars . load ( returning) . await ? {
4970 Rows :: Count ( _) => ValueStream :: default ( ) ,
5071 Rows :: Values ( value_stream) => value_stream,
5172 }
5273 } else {
5374 ValueStream :: default ( )
5475 } )
5576 }
77+ }
5678
79+ impl Exec < ' _ > {
5780 async fn exec_step ( & mut self , action : & Action ) -> Result < ( ) > {
5881 match action {
5982 Action :: DeleteByKey ( action) => self . action_delete_by_key ( action) . await ,
@@ -70,7 +93,7 @@ impl Exec<'_> {
7093 }
7194 }
7295
73- async fn collect_input2 ( & mut self , input : & [ VarId ] ) -> Result < Vec < stmt:: Value > > {
96+ async fn collect_input ( & mut self , input : & [ VarId ] ) -> Result < Vec < stmt:: Value > > {
7497 let mut ret = Vec :: new ( ) ;
7598
7699 for var_id in input {
0 commit comments