pub enum Field {
JsonbField(String),
DirectColumn(String),
JsonbPath(Vec<String>),
}Expand description
Represents a field reference in a WHERE clause or ORDER BY
Supports both JSONB payload fields and direct database columns, with automatic type casting and proper SQL generation.
§Examples
use fraiseql_wire::operators::Field;
// JSONB field: (data->>'name')
let _ = Field::JsonbField("name".to_string());
// Direct column: created_at
let _ = Field::DirectColumn("created_at".to_string());
// Nested JSONB: (data->'user'->>'name')
let _ = Field::JsonbPath(vec!["user".to_string(), "name".to_string()]);Variants§
JsonbField(String)
A field extracted from the JSONB data column with text extraction (->>)
The value is extracted as text and wrapped in parentheses.
Generated SQL: (data->>'field_name')
DirectColumn(String)
A direct database column (not from JSONB)
Uses the native type stored in the database.
Generated SQL: column_name
JsonbPath(Vec<String>)
A nested path within the JSONB data column
The path is traversed left-to-right, with intermediate steps using -> (JSON navigation)
and the final step using ->> (text extraction).
All extracted values are text and wrapped in parentheses.
Generated SQL: (data->'path[0]'->...->>'path[n]')
Implementations§
Trait Implementations§
impl Eq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more