pub struct FunctionSignature {
pub name: String,
pub parameters: Vec<FunctionParameter>,
pub return_type: SqlType,
pub is_aggregate: bool,
pub is_window: bool,
pub is_deterministic: bool,
pub min_args: usize,
pub max_args: Option<usize>,
}Expand description
Function signature for built-in and user-defined functions.
Fields§
§name: StringFunction name (uppercase).
parameters: Vec<FunctionParameter>Parameter types (None means any type is accepted).
return_type: SqlTypeReturn type.
is_aggregate: boolWhether this is an aggregate function.
is_window: boolWhether this is a window function.
is_deterministic: boolWhether the function is deterministic.
min_args: usizeMinimum number of arguments.
max_args: Option<usize>Maximum number of arguments (None = unlimited).
Implementations§
Source§impl FunctionSignature
impl FunctionSignature
Sourcepub fn scalar(name: impl Into<String>, return_type: SqlType) -> Self
pub fn scalar(name: impl Into<String>, return_type: SqlType) -> Self
Create a scalar function signature.
Sourcepub fn aggregate(name: impl Into<String>, return_type: SqlType) -> Self
pub fn aggregate(name: impl Into<String>, return_type: SqlType) -> Self
Create an aggregate function signature.
Sourcepub fn window(name: impl Into<String>, return_type: SqlType) -> Self
pub fn window(name: impl Into<String>, return_type: SqlType) -> Self
Create a window function signature.
Sourcepub fn with_min_args(self, min: usize) -> Self
pub fn with_min_args(self, min: usize) -> Self
Set minimum number of arguments.
Sourcepub fn with_max_args(self, max: usize) -> Self
pub fn with_max_args(self, max: usize) -> Self
Set maximum number of arguments.
Sourcepub fn with_param(self, param: FunctionParameter) -> Self
pub fn with_param(self, param: FunctionParameter) -> Self
Add a parameter.
Sourcepub fn non_deterministic(self) -> Self
pub fn non_deterministic(self) -> Self
Mark as non-deterministic.
Sourcepub fn accepts_arg_count(&self, count: usize) -> bool
pub fn accepts_arg_count(&self, count: usize) -> bool
Check if the given number of arguments is valid.
Sourcepub fn can_be_window(&self) -> bool
pub fn can_be_window(&self) -> bool
Check if the function can be used in a window context.
Trait Implementations§
Source§impl Clone for FunctionSignature
impl Clone for FunctionSignature
Source§fn clone(&self) -> FunctionSignature
fn clone(&self) -> FunctionSignature
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FunctionSignature
impl Debug for FunctionSignature
Source§impl PartialEq for FunctionSignature
impl PartialEq for FunctionSignature
impl StructuralPartialEq for FunctionSignature
Auto Trait Implementations§
impl Freeze for FunctionSignature
impl RefUnwindSafe for FunctionSignature
impl Send for FunctionSignature
impl Sync for FunctionSignature
impl Unpin for FunctionSignature
impl UnwindSafe for FunctionSignature
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