Struct sql_parse::CreateFunction
source · [−]pub struct CreateFunction<'a> {
pub create_span: Span,
pub create_options: Vec<CreateOption<'a>>,
pub function_span: Span,
pub if_not_exists: Option<Span>,
pub name: Identifier<'a>,
pub params: Vec<(FunctionParamDirection, Identifier<'a>, DataType<'a>)>,
pub returns_span: Span,
pub return_type: DataType<'a>,
pub characteristics: Vec<FunctionCharacteristic<'a>>,
pub return_: Box<Statement<'a>>,
}
Expand description
Representation of Create Function Statement
This is not fully implemented yet
ⓘ
let sql = "DELIMITER $$
CREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT
BEGIN
SET c = 100;
RETURN a + b;
END;
$$
DELIMITER ;";
let mut stmts = parse_statements(sql, &mut issues, &options);
assert!(issues.is_empty());
let create: CreateFunction = match stmts.pop() {
Some(Statement::CreateFunction(c)) => c,
_ => panic!("We should get an create function statement")
};
assert!(create.name.as_str() == "add_func3");
println!("{:#?}", create.return_)
Fields
create_span: Span
Span of “CREATE”
create_options: Vec<CreateOption<'a>>
Options after “CREATE”
function_span: Span
Span of “FUNCTION”
if_not_exists: Option<Span>
Span of “IF NOT EXISTS” if specified
name: Identifier<'a>
Name o created function
params: Vec<(FunctionParamDirection, Identifier<'a>, DataType<'a>)>
Names and types of function arguments
returns_span: Span
Span of “RETURNS”
return_type: DataType<'a>
Type of return value
characteristics: Vec<FunctionCharacteristic<'a>>
Characteristics of created function
return_: Box<Statement<'a>>
Statement computing return value
Trait Implementations
sourceimpl<'a> Clone for CreateFunction<'a>
impl<'a> Clone for CreateFunction<'a>
sourcefn clone(&self) -> CreateFunction<'a>
fn clone(&self) -> CreateFunction<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for CreateFunction<'a>
impl<'a> Debug for CreateFunction<'a>
sourceimpl<'a> Spanned for CreateFunction<'a>
impl<'a> Spanned for CreateFunction<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for CreateFunction<'a>
impl<'a> Send for CreateFunction<'a>
impl<'a> Sync for CreateFunction<'a>
impl<'a> Unpin for CreateFunction<'a>
impl<'a> UnwindSafe for CreateFunction<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more