@@ -63,16 +63,14 @@ pub(crate) fn execute_plan(
6363 } else {
6464 Some ( edge_types. as_slice ( ) )
6565 } ;
66- let res = db
67- . graph ( )
68- . bfs (
69- start,
70- edge_types_ref,
71- * direction,
72- * min_depth,
73- * max_depth,
74- db. snapshot ( ) ,
75- ) ?;
66+ let res = db. graph ( ) . bfs (
67+ start,
68+ edge_types_ref,
69+ * direction,
70+ * min_depth,
71+ * max_depth,
72+ db. snapshot ( ) ,
73+ ) ?;
7674
7775 Ok ( QueryResult {
7876 columns : vec ! [ "id" . to_string( ) , "depth" . to_string( ) ] ,
@@ -114,7 +112,9 @@ pub(crate) fn execute_plan(
114112 columns : vec ! [ "row_id" . to_string( ) , "score" . to_string( ) ] ,
115113 rows : res
116114 . into_iter ( )
117- . map ( |( rid, score) | vec ! [ Value :: Int64 ( rid as i64 ) , Value :: Float64 ( score as f64 ) ] )
115+ . map ( |( rid, score) | {
116+ vec ! [ Value :: Int64 ( rid as i64 ) , Value :: Float64 ( score as f64 ) ]
117+ } )
118118 . collect ( ) ,
119119 rows_affected : 0 ,
120120 } )
@@ -127,7 +127,9 @@ pub(crate) fn execute_plan(
127127 }
128128 Ok ( last)
129129 }
130- _ => Err ( Error :: PlanError ( "unsupported plan node in executor" . to_string ( ) ) ) ,
130+ _ => Err ( Error :: PlanError (
131+ "unsupported plan node in executor" . to_string ( ) ,
132+ ) ) ,
131133 }
132134}
133135
@@ -159,19 +161,17 @@ fn exec_insert(
159161 } ;
160162
161163 if p. table == "edges"
162- && let ( Some ( Value :: Uuid ( source) ) , Some ( Value :: Uuid ( target) ) , Some ( Value :: Text ( edge_type) ) ) = (
164+ && let (
165+ Some ( Value :: Uuid ( source) ) ,
166+ Some ( Value :: Uuid ( target) ) ,
167+ Some ( Value :: Text ( edge_type) ) ,
168+ ) = (
163169 values. get ( "source_id" ) ,
164170 values. get ( "target_id" ) ,
165171 values. get ( "edge_type" ) ,
166172 )
167173 {
168- db. insert_edge (
169- txid,
170- * source,
171- * target,
172- edge_type. clone ( ) ,
173- HashMap :: new ( ) ,
174- ) ?;
174+ db. insert_edge ( txid, * source, * target, edge_type. clone ( ) , HashMap :: new ( ) ) ?;
175175 }
176176
177177 if let Some ( Value :: Vector ( v) ) = values. get ( "embedding" )
@@ -197,7 +197,11 @@ fn exec_delete(
197197 let rows = db. scan ( & p. table , snapshot) ?;
198198 let matched: Vec < _ > = rows
199199 . into_iter ( )
200- . filter ( |r| p. where_clause . as_ref ( ) . is_none_or ( |w| row_matches ( r, w, params) . unwrap_or ( false ) ) )
200+ . filter ( |r| {
201+ p. where_clause
202+ . as_ref ( )
203+ . is_none_or ( |w| row_matches ( r, w, params) . unwrap_or ( false ) )
204+ } )
201205 . collect ( ) ;
202206
203207 for row in & matched {
@@ -218,7 +222,11 @@ fn exec_update(
218222 let rows = db. scan ( & p. table , snapshot) ?;
219223 let matched: Vec < _ > = rows
220224 . into_iter ( )
221- . filter ( |r| p. where_clause . as_ref ( ) . is_none_or ( |w| row_matches ( r, w, params) . unwrap_or ( false ) ) )
225+ . filter ( |r| {
226+ p. where_clause
227+ . as_ref ( )
228+ . is_none_or ( |w| row_matches ( r, w, params) . unwrap_or ( false ) )
229+ } )
222230 . collect ( ) ;
223231
224232 for row in & matched {
@@ -286,7 +294,11 @@ fn row_matches(row: &VersionedRow, expr: &Expr, params: &HashMap<String, Value>)
286294 }
287295}
288296
289- fn eval_expr_value ( row : & VersionedRow , expr : & Expr , params : & HashMap < String , Value > ) -> Result < Value > {
297+ fn eval_expr_value (
298+ row : & VersionedRow ,
299+ expr : & Expr ,
300+ params : & HashMap < String , Value > ,
301+ ) -> Result < Value > {
290302 match expr {
291303 Expr :: Column ( c) => Ok ( row. values . get ( & c. column ) . cloned ( ) . unwrap_or ( Value :: Null ) ) ,
292304 _ => resolve_expr ( expr, params) ,
@@ -317,7 +329,9 @@ fn resolve_uuid(expr: &Expr, params: &HashMap<String, Value>) -> Result<uuid::Uu
317329 Value :: Uuid ( u) => Ok ( u) ,
318330 Value :: Text ( t) => uuid:: Uuid :: parse_str ( & t)
319331 . map_err ( |e| Error :: PlanError ( format ! ( "invalid uuid '{}': {}" , t, e) ) ) ,
320- _ => Err ( Error :: PlanError ( "graph start node must be UUID" . to_string ( ) ) ) ,
332+ _ => Err ( Error :: PlanError (
333+ "graph start node must be UUID" . to_string ( ) ,
334+ ) ) ,
321335 }
322336}
323337
@@ -328,7 +342,9 @@ fn resolve_vector_from_expr(expr: &Expr, params: &HashMap<String, Value>) -> Res
328342 Some ( Value :: Vector ( v) ) => Ok ( v. clone ( ) ) ,
329343 _ => Err ( Error :: PlanError ( "vector parameter missing" . to_string ( ) ) ) ,
330344 } ,
331- _ => Err ( Error :: PlanError ( "invalid vector query expression" . to_string ( ) ) ) ,
345+ _ => Err ( Error :: PlanError (
346+ "invalid vector query expression" . to_string ( ) ,
347+ ) ) ,
332348 }
333349}
334350
0 commit comments