Expand description
Zero-copy types for performance-critical operations.
This module provides borrowed/reference-based versions of common types to avoid unnecessary allocations in hot paths.
§Types
| Owned Type | Zero-Copy Type | Use Case |
|---|---|---|
JsonPath | JsonPathRef<'a> | JSON path queries with borrowed strings |
WindowSpec | WindowSpecRef<'a> | Window function specs with borrowed columns |
Cte | CteRef<'a> | CTE definitions with borrowed column slices |
§Performance Benefits
- Avoids
Stringallocations when using string literals or borrowed data - Reduces memory copies in query building hot paths
- Enables zero-copy deserialization patterns
§Example
use prax_query::zero_copy::{JsonPathRef, PathSegmentRef, WindowSpecRef};
use prax_query::sql::DatabaseType;
// Zero-copy JSON path - no allocations!
let path = JsonPathRef::new("metadata")
.field("role")
.field("permissions");
let sql = path.to_sql(DatabaseType::PostgreSQL);
// Zero-copy window spec
let spec = WindowSpecRef::new()
.partition_by(&["dept", "team"])
.order_by_asc("salary");
let sql = spec.to_sql(DatabaseType::PostgreSQL);Structs§
- CteRef
- A zero-copy CTE definition that accepts column slices.
- Frame
Ref - A frame clause for window specifications.
- Json
Path Ref - A zero-copy JSON path expression that borrows strings where possible.
- Window
Spec Ref - A zero-copy window specification using borrowed column references.
- With
Clause Ref - A builder for WITH clauses using zero-copy CTEs.
Enums§
- Frame
Bound Ref - Frame bound specification.
- Frame
Type Ref - Frame type for window functions.
- Path
Segment Ref - A segment in a zero-copy JSON path.