Skip to main content

func

Function func 

Source
pub fn func(name: &str, args: impl IntoIterator<Item = Expr>) -> Expr
Expand description

Create a SQL function call expression.

name is the function name (e.g. "COUNT", "UPPER", "COALESCE"), and args provides zero or more argument expressions.

ยงExamples

use polyglot_sql::builder::{func, col, star};

let upper = func("UPPER", [col("name")]);
assert_eq!(upper.to_sql(), "UPPER(name)");

let count = func("COUNT", [star()]);
assert_eq!(count.to_sql(), "COUNT(*)");