@@ -292,21 +292,25 @@ impl<T> ResultExt<T> for google_drive3::Result<T> {
292292 }
293293}
294294
295+ fn optional_modified_time ( include_ordinal : bool ) -> & ' static str {
296+ if include_ordinal {
297+ ",modifiedTime"
298+ } else {
299+ ""
300+ }
301+ }
302+
295303#[ async_trait]
296304impl SourceExecutor for Executor {
297- fn list (
298- & self ,
299- options : SourceExecutorListOptions ,
300- ) -> BoxStream < ' _ , Result < Vec < SourceRowMetadata > > > {
305+ fn list < ' a > (
306+ & ' a self ,
307+ options : & ' a SourceExecutorListOptions ,
308+ ) -> BoxStream < ' a , Result < Vec < SourceRowMetadata > > > {
301309 let mut seen_ids = HashSet :: new ( ) ;
302310 let mut folder_ids = self . root_folder_ids . clone ( ) ;
303311 let fields = format ! (
304312 "files(id,name,mimeType,trashed{})" ,
305- if options. include_ordinal {
306- ",modifiedTime"
307- } else {
308- ""
309- }
313+ optional_modified_time( options. include_ordinal)
310314 ) ;
311315 let mut new_folder_ids = Vec :: new ( ) ;
312316 try_stream ! {
@@ -333,20 +337,35 @@ impl SourceExecutor for Executor {
333337 . boxed ( )
334338 }
335339
336- async fn get_value ( & self , key : & KeyValue ) -> Result < Option < FieldValues > > {
340+ async fn get_value (
341+ & self ,
342+ key : & KeyValue ,
343+ options : & SourceExecutorGetOptions ,
344+ ) -> Result < SourceValue > {
337345 let file_id = key. str_value ( ) ?;
346+ let fields = format ! (
347+ "id,name,mimeType,trashed{}" ,
348+ optional_modified_time( options. include_ordinal)
349+ ) ;
338350 let resp = self
339351 . drive_hub
340352 . files ( )
341353 . get ( file_id)
342354 . add_scope ( Scope :: Readonly )
343- . param ( "fields" , "id,name,mimeType,trashed" )
355+ . param ( "fields" , & fields )
344356 . doit ( )
345357 . await
346358 . or_not_found ( ) ?;
347359 let file = match resp {
348360 Some ( ( _, file) ) if file. trashed != Some ( true ) => file,
349- _ => return Ok ( None ) ,
361+ _ => {
362+ return Ok ( SourceValue :: default ( ) ) ;
363+ }
364+ } ;
365+ let ordinal = if options. include_ordinal {
366+ file. modified_time . map ( |t| t. try_into ( ) ) . transpose ( ) ?
367+ } else {
368+ None
350369 } ;
351370 let type_n_body = if let Some ( export_mime_type) = file
352371 . mime_type
@@ -396,7 +415,7 @@ impl SourceExecutor for Executor {
396415 }
397416 None => None ,
398417 } ;
399- Ok ( value)
418+ Ok ( SourceValue { value, ordinal } )
400419 }
401420
402421 async fn change_stream ( & self ) -> Result < Option < BoxStream < ' async_trait , SourceChange > > > {
0 commit comments