@@ -393,77 +393,3 @@ pub trait Storelike: Sized {
393393 crate :: validate:: validate_store ( self , false )
394394 }
395395}
396-
397- /// Use this to construct a list of Resources
398- #[ derive( Debug ) ]
399- pub struct Query {
400- /// Filter by Property
401- pub property : Option < String > ,
402- /// Filter by Value
403- pub value : Option < Value > ,
404- /// Maximum of items to return, if none returns all items.
405- pub limit : Option < usize > ,
406- /// Value at which to begin lexicographically sorting things.
407- pub start_val : Option < Value > ,
408- /// Value at which to stop lexicographically sorting things.
409- pub end_val : Option < Value > ,
410- /// How many items to skip from the first one
411- pub offset : usize ,
412- /// The Property URL that is used to sort the results
413- pub sort_by : Option < String > ,
414- /// Sort descending instead of ascending.
415- pub sort_desc : bool ,
416- /// Whether to include non-server resources
417- pub include_external : bool ,
418- /// Whether to include full Resources in the result, if not, will add empty vector here.
419- pub include_nested : bool ,
420- /// For which Agent the query is executed. Pass `None` if you want to skip permission checks.
421- pub for_agent : ForAgent ,
422- }
423-
424- impl Query {
425- pub fn new ( ) -> Self {
426- Query {
427- property : None ,
428- value : None ,
429- limit : None ,
430- start_val : None ,
431- end_val : None ,
432- offset : 0 ,
433- sort_by : None ,
434- sort_desc : false ,
435- include_external : false ,
436- include_nested : true ,
437- for_agent : ForAgent :: Sudo ,
438- }
439- }
440-
441- /// Search for a property-value combination
442- pub fn new_prop_val ( prop : & str , val : & str ) -> Self {
443- let mut q = Self :: new ( ) ;
444- q. property = Some ( prop. to_string ( ) ) ;
445- q. value = Some ( Value :: String ( val. to_string ( ) ) ) ;
446- q
447- }
448-
449- /// Search for instances of some Class
450- pub fn new_class ( class : & str ) -> Self {
451- let mut q = Self :: new ( ) ;
452- q. property = Some ( urls:: IS_A . into ( ) ) ;
453- q. value = Some ( Value :: AtomicUrl ( class. to_string ( ) ) ) ;
454- q
455- }
456- }
457-
458- impl Default for Query {
459- fn default ( ) -> Self {
460- Self :: new ( )
461- }
462- }
463-
464- pub struct QueryResult {
465- pub subjects : Vec < String > ,
466- pub resources : Vec < Resource > ,
467- /// The amount of hits that were found, including the ones that were out of bounds or not authorized.
468- pub count : usize ,
469- }
0 commit comments