grafbase_sql_ast/ast/function/
lower.rs

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