Skip to main content

Crate paginate_core

Crate paginate_core 

Source
Expand description

§paginate-core

Pure, language-agnostic engine behind the pypaginate (Python) and @cyblow/paginate (TypeScript) packages. It owns the computational heart of the library — cursor encoding, offset math, text normalization, filtering, sorting and search — with zero binding dependencies so the exact same crate links natively into Python (via PyO3) and Node/TypeScript (via napi-rs), and compiles unchanged to WebAssembly for an optional browser/edge target.

§Design rules

  • Plain data only. Everything crosses the boundary as value::Value, a small JSON-like enum. No host objects, no framework types.
  • Deterministic & side-effect free. Same input, same output — which is what lets the shared property-based invariants double as every binding’s conformance suite.
  • Behaviour parity. Each binding wraps this one engine, so results match across languages (e.g. the cursor wire format is byte-identical, so cursors minted by any implementation decode in the others).

Re-exports§

pub use columnar::Columns;
pub use cursor::decode_cursor;
pub use cursor::encode_cursor;
pub use filter::FilterGroup;
pub use filter::FilterInput;
pub use filter::FilterLogic;
pub use filter::FilterNode;
pub use filter::FilterOp;
pub use filter::FilterSpec;
pub use normalize::normalize_text;
pub use pagination::Limit;
pub use pipeline::offset_page;
pub use pipeline::offset_page_searched;
pub use pipeline::Page;
pub use pipeline::SearchStage;
pub use search::FuzzyMode;
pub use search::SearchFieldMode;
pub use search::SearchSpec;
pub use search::TrigramIndex;
pub use sort::NullsPosition;
pub use sort::SortDirection;
pub use sort::SortSpec;
pub use validate::MAX_LIMIT;
pub use value::Value;

Modules§

columnar
Typed columns for a fast single-field filter and single-key sort path.
cursor
Cursor value encoding/decoding for keyset pagination.
filter
In-memory filtering: 20 operators, flat AND/OR lists, and nested groups. Behaviour mirrors pypaginate’s filtering/ package.
json
Lossy bridge between serde_json::Value and the core Value model.
keyset
Portable keyset (cursor) predicate structure.
normalize
Text normalization for search and filtering.
pagination
Offset/limit pagination arithmetic.
pipeline
High-level pagination pipeline: filter → search → sort → offset-paginate in one pass, returning the page’s item indices plus offset metadata.
resident
Single-operation queries over a resident dataset — the host rows marshalled once into Value plus their prebuilt typed Columns.
schema
Wire-form DTOs + JSON Schema export — the cross-language type contract.
search
Full-text in-memory search with ranking, ported from pypaginate’s search/.
sort
Stable, multi-key in-memory sort with null placement.
validate
Canonical validation of pagination inputs.
value
The plain, language-agnostic value model that crosses the FFI boundary.

Enums§

CoreError
A recoverable error raised by the core engine.
ErrorKind
Stable, message-independent classification of a CoreError.

Type Aliases§

Result
Convenience alias used throughout the crate.