1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2026 metamuffin <metamuffin.org>
*/
use jellyobject::Path;
#[derive(Default)]
pub struct Query {
pub filter: Filter,
pub sort: Sort,
}
#[derive(Default)]
pub enum Sort {
#[default]
None,
Value(ValueSortComponent),
TextSearch(Path, String),
}
pub struct ValueSortComponent {
pub order: SortOrder,
pub path: Path,
pub multi: MultiBehaviour,
pub offset: Option<Vec<u8>>,
}
pub enum MultiBehaviour {
First,
ForEach,
Max,
Min,
Count,
}
pub enum SortOrder {
Ascending,
Descending,
}
#[derive(Debug, Clone, Default)]
pub enum Filter {
#[default]
True,
All(Vec<Filter>),
Any(Vec<Filter>),
Match(Path, Vec<u8>),
Has(Path),
}
|