grafbase_sql_ast/ast/function/
upper.rs

1use crate::ast::{Expression, Function, FunctionType};
2
3/// A represention of the `UPPER` function in the database.
4#[derive(Debug, Clone, PartialEq)]
5pub struct Upper<'a> {
6    pub(crate) expression: Box<Expression<'a>>,
7}
8
9/// Converts the result of the expression into uppercase string.
10pub fn upper<'a, E>(expression: E) -> Function<'a>
11where
12    E: Into<Expression<'a>>,
13{
14    let fun = Upper {
15        expression: Box::new(expression.into()),
16    };
17
18    fun.into()
19}
20
21impl<'a> From<Upper<'a>> for Function<'a> {
22    fn from(value: Upper<'a>) -> Self {
23        Self {
24            typ_: FunctionType::Upper(value),
25            alias: None,
26        }
27    }
28}