diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-01-14 02:25:09 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-01-14 02:25:09 +0100 |
| commit | b5ff460e938779be4eeab292c2cc1d436b93c137 (patch) | |
| tree | 1c01ee1ca923ac4f302b312eb175aa77aa344a1d /database | |
| parent | 72a718fffb236c4b157e4d62c2e486ca7b326a26 (diff) | |
| download | jellything-b5ff460e938779be4eeab292c2cc1d436b93c137.tar jellything-b5ff460e938779be4eeab292c2cc1d436b93c137.tar.bz2 jellything-b5ff460e938779be4eeab292c2cc1d436b93c137.tar.zst | |
Store object values as big endian; Draft query types
Diffstat (limited to 'database')
| -rw-r--r-- | database/src/lib.rs | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/database/src/lib.rs b/database/src/lib.rs index 32d160b..df314b6 100644 --- a/database/src/lib.rs +++ b/database/src/lib.rs @@ -10,16 +10,40 @@ pub mod table; pub type Pad32 = u32; -use jellycommon::jellyobject::{Object, Tag, TypedTag}; +use jellycommon::jellyobject::Tag; -enum Query<'a> { - MatchStr(Match<'a, &'a str>), - MatchF64(Match<'a, f64>), - MatchU64(Match<'a, u64>), - MatchTag(Match<'a, Tag>), - Has(Path<'a>), +pub struct Query { + pub filter: Filter, + pub sort: Sort, } -pub struct Match<'a, T>(pub TypedPath<'a, T>, pub T); -pub struct TypedPath<'a, T>(pub &'a [TypedTag<Object<'static>>], pub TypedTag<T>); -pub struct Path<'a>(pub &'a [TypedTag<Object<'static>>], pub Tag); +pub enum Sort { + None, + Value(Vec<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, +} +pub enum Filter { + And(Vec<Filter>), + Or(Vec<Filter>), + Match(Path, Vec<u8>), + Has(Path), +} + +pub struct Path(pub Vec<Tag>); |