pub enum Operation {
Select(ParsedParams, Option<PreferOptions>),
Insert(InsertParams, Option<PreferOptions>),
Update(UpdateParams, Option<PreferOptions>),
Delete(DeleteParams, Option<PreferOptions>),
Rpc(RpcParams, Option<PreferOptions>),
}Expand description
Represents all supported PostgREST operations (GET, POST, PATCH, DELETE, PUT, RPC).
Each variant contains operation-specific parameters and optional Prefer header preferences.
§Examples
use postgrest_parser::{parse, Operation};
// Parse a SELECT operation
let op = parse("GET", "users", "id=eq.123", None, None).unwrap();
match op {
Operation::Select(params, prefer) => {
assert!(params.has_filters());
assert!(prefer.is_none());
}
_ => panic!("Expected Select"),
}
// Parse an INSERT operation
let body = r#"{"name": "Alice", "email": "alice@example.com"}"#;
let op = parse("POST", "users", "", Some(body), None).unwrap();
match op {
Operation::Insert(params, _) => {
assert!(!params.values.is_empty());
}
_ => panic!("Expected Insert"),
}Variants§
Select(ParsedParams, Option<PreferOptions>)
SELECT query with parsed parameters and optional Prefer header
Insert(InsertParams, Option<PreferOptions>)
INSERT query with values, conflict resolution, and optional Prefer header
Update(UpdateParams, Option<PreferOptions>)
UPDATE query with SET values, filters, and optional Prefer header
Delete(DeleteParams, Option<PreferOptions>)
DELETE query with filters and optional Prefer header
Rpc(RpcParams, Option<PreferOptions>)
RPC function call with arguments, filters, and optional Prefer header
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Operation
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnwindSafe for Operation
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