grafbase_sql_ast/ast/function/
sum.rs1use crate::ast::{Expression, Function, FunctionType};
2
3#[derive(Debug, Clone, PartialEq)]
5pub struct Sum<'a> {
6 pub(crate) expr: Box<Expression<'a>>,
7}
8
9pub fn sum<'a, E>(expr: E) -> Function<'a>
11where
12 E: Into<Expression<'a>>,
13{
14 let fun = Sum {
15 expr: Box::new(expr.into()),
16 };
17
18 fun.into()
19}
20
21impl<'a> From<Sum<'a>> for Function<'a> {
22 fn from(value: Sum<'a>) -> Self {
23 Self {
24 typ_: FunctionType::Sum(value),
25 alias: None,
26 }
27 }
28}