surrealdb_expr/expr/limit.rs
1use surrealdb_types::{SqlFormat, ToSql};
2
3use crate::expr::Expr;
4
5#[derive(Clone, Debug, Eq, PartialEq, Hash)]
6pub struct Limit(pub Expr);
7
8impl Limit {
9 /// Whether evaluating the limit expression can be done on a read-only
10 /// transaction.
11 pub fn read_only(&self) -> bool {
12 self.0.read_only()
13 }
14}
15
16impl ToSql for Limit {
17 fn fmt_sql(&self, f: &mut String, sql_fmt: SqlFormat) {
18 let stmt: crate::sql::limit::Limit = self.clone().into();
19 stmt.fmt_sql(f, sql_fmt);
20 }
21}