Function quaint::ast::row_number
source · pub fn row_number<'a>() -> RowNumber<'a>
Expand description
A number from 1 to n in specified order
let fun = Function::from(row_number().order_by("created_at").partition_by("name"));
let query = Select::from_table("users")
.column("id")
.value(fun.alias("num"));
let (sql, _) = Sqlite::build(query)?;
assert_eq!(
"SELECT `id`, ROW_NUMBER() OVER(PARTITION BY `name` ORDER BY `created_at`) AS `num` FROM `users`",
sql
);