MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / limit_from_query

Function limit_from_query

nodedb-sql/src/planner/lateral/plan.rs:263–273  ·  view source on GitHub ↗

Extract the LIMIT value from a query.

(query: &ast::Query)

Source from the content-addressed store, hash-verified

261
262/// Extract the LIMIT value from a query.
263fn limit_from_query(query: &ast::Query) -> Option<usize> {
264 match &query.limit_clause {
265 Some(ast::LimitClause::LimitOffset { limit, .. }) => {
266 limit.as_ref().and_then(expr_as_usize_literal)
267 }
268 Some(ast::LimitClause::OffsetCommaLimit { limit, .. }) => {
269 Some(expr_as_usize_literal(limit).unwrap_or(0))
270 }
271 None => None,
272 }
273}
274
275/// Extract a LATERAL alias from a `TableFactor::Derived`.
276pub fn lateral_alias_from_factor(factor: &ast::TableFactor) -> Option<String> {

Callers 1

plan_lateral_joinFunction · 0.85

Calls 2

expr_as_usize_literalFunction · 0.85
as_refMethod · 0.45

Tested by

no test coverage detected