grafbase_sql_ast/ast/function/
count.rs1use super::Function;
2use crate::ast::{Expression, FunctionType};
3
4#[derive(Debug, Clone, PartialEq)]
5pub struct Count<'a> {
7 pub(crate) exprs: Vec<Expression<'a>>,
8}
9
10pub fn count<'a, T>(expr: T) -> Function<'a>
12where
13 T: Into<Expression<'a>>,
14{
15 let fun = Count {
16 exprs: vec![expr.into()],
17 };
18
19 fun.into()
20}
21
22impl<'a> From<Count<'a>> for Function<'a> {
23 fn from(value: Count<'a>) -> Self {
24 Self {
25 typ_: FunctionType::Count(value),
26 alias: None,
27 }
28 }
29}