Deploying to gh-pages from @ GreptimeTeam/greptimedb@4f290111db 🚀

This commit is contained in:
github-merge-queue[bot]
2025-12-25 19:26:42 +00:00
commit be34bef8e7
20293 changed files with 2354131 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

489
sql/ast/enum.DataType.html Normal file

File diff suppressed because one or more lines are too long

606
sql/ast/enum.Expr.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

264
sql/ast/enum.SqlOption.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

288
sql/ast/enum.Value.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Invokes the provided closure iteratively with a mutable reference to all expressions present in `v`."><title>visit_expressions_mut in sql::ast - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="sql" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">visit_expressions_mut</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../sql/index.html">sql</a><span class="version">1.0.0-beta.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">visit_<wbr>expressions_<wbr>mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a><ul><li><a href="#remove-all-select-limits-in-sub-queries" title="Remove all select limits in sub-queries">Remove all select limits in sub-queries</a></li><li><a href="#wrap-column-name-in-function-call" title="Wrap column name in function call">Wrap column name in function call</a></li></ul></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In sql::<wbr>ast</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">sql</a>::<wbr><a href="index.html">ast</a></div><h1>Function <span class="fn">visit_<wbr>expressions_<wbr>mut</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn visit_expressions_mut&lt;V, E, F&gt;(v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut V</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;E&gt;<div class="where">where
V: <a class="trait" href="trait.VisitMut.html" title="trait sql::ast::VisitMut">VisitMut</a>,
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;mut <a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;E&gt;,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Invokes the provided closure iteratively with a mutable reference to all expressions
present in <code>v</code>.</p>
<p>This performs a depth-first search, so if the closure mutates the expression</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2><h3 id="remove-all-select-limits-in-sub-queries"><a class="doc-anchor" href="#remove-all-select-limits-in-sub-queries">§</a>Remove all select limits in sub-queries</h3>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>sql = <span class="string">"SELECT (SELECT y FROM z LIMIT 9) FROM t LIMIT 3"</span>;
<span class="kw">let </span><span class="kw-2">mut </span>statements = Parser::parse_sql(<span class="kw-2">&amp;</span>GenericDialect{}, sql).unwrap();
<span class="comment">// Remove all select limits in sub-queries
</span>visit_expressions_mut(<span class="kw-2">&amp;mut </span>statements, |expr| {
<span class="kw">if let </span>Expr::Subquery(q) = expr {
q.limit_clause = <span class="prelude-val">None</span>;
}
ControlFlow::&lt;()&gt;::Continue(())
});
<span class="macro">assert_eq!</span>(statements[<span class="number">0</span>].to_string(), <span class="string">"SELECT (SELECT y FROM z) FROM t LIMIT 3"</span>);</code></pre></div><h3 id="wrap-column-name-in-function-call"><a class="doc-anchor" href="#wrap-column-name-in-function-call">§</a>Wrap column name in function call</h3>
<p>This demonstrates how to effectively replace an expression with another more complicated one
that references the original. This example avoids unnecessary allocations by using the
<a href="https://doc.rust-lang.org/nightly/core/mem/index.html" title="mod core::mem"><code>std::mem</code></a> family of functions.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>sql = <span class="string">"SELECT x, y FROM t"</span>;
<span class="kw">let </span><span class="kw-2">mut </span>statements = Parser::parse_sql(<span class="kw-2">&amp;</span>GenericDialect{}, sql).unwrap();
visit_expressions_mut(<span class="kw-2">&amp;mut </span>statements, |expr| {
<span class="kw">if </span><span class="macro">matches!</span>(expr, Expr::Identifier(col_name) <span class="kw">if </span>col_name.value == <span class="string">"x"</span>) {
<span class="kw">let </span>old_expr = std::mem::replace(expr, Expr::value(Value::Null));
<span class="kw-2">*</span>expr = Expr::Function(Function {
name: ObjectName::from(<span class="macro">vec!</span>[Ident::new(<span class="string">"f"</span>)]),
uses_odbc_syntax: <span class="bool-val">false</span>,
args: FunctionArguments::List(FunctionArgumentList {
duplicate_treatment: <span class="prelude-val">None</span>,
args: <span class="macro">vec!</span>[FunctionArg::Unnamed(FunctionArgExpr::Expr(old_expr))],
clauses: <span class="macro">vec!</span>[],
}),
null_treatment: <span class="prelude-val">None</span>,
filter: <span class="prelude-val">None</span>,
over: <span class="prelude-val">None</span>,
parameters: FunctionArguments::None,
within_group: <span class="macro">vec!</span>[],
});
}
ControlFlow::&lt;()&gt;::Continue(())
});
<span class="macro">assert_eq!</span>(statements[<span class="number">0</span>].to_string(), <span class="string">"SELECT f(x), y FROM t"</span>);</code></pre></div></div></details></section></div></main></body></html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Invokes the provided closure on all statements (e.g. `SELECT`, `CREATE TABLE`, etc) present in `v`"><title>visit_statements_mut in sql::ast - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="sql" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">visit_statements_mut</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../sql/index.html">sql</a><span class="version">1.0.0-beta.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">visit_<wbr>statements_<wbr>mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In sql::<wbr>ast</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">sql</a>::<wbr><a href="index.html">ast</a></div><h1>Function <span class="fn">visit_<wbr>statements_<wbr>mut</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn visit_statements_mut&lt;V, E, F&gt;(v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut V</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;E&gt;<div class="where">where
V: <a class="trait" href="trait.VisitMut.html" title="trait sql::ast::VisitMut">VisitMut</a>,
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;mut Statement) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;E&gt;,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Invokes the provided closure on all statements (e.g. <code>SELECT</code>, <code>CREATE TABLE</code>, etc) present in <code>v</code></p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>sql = <span class="string">"SELECT x FROM foo LIMIT 9+$limit; SELECT * FROM t LIMIT f()"</span>;
<span class="kw">let </span><span class="kw-2">mut </span>statements = Parser::parse_sql(<span class="kw-2">&amp;</span>GenericDialect{}, sql).unwrap();
<span class="comment">// Remove all select limits in outer statements (not in sub-queries)
</span>visit_statements_mut(<span class="kw-2">&amp;mut </span>statements, |stmt| {
<span class="kw">if let </span>Statement::Query(q) = stmt {
q.limit_clause = <span class="prelude-val">None</span>;
}
ControlFlow::&lt;()&gt;::Continue(())
});
<span class="macro">assert_eq!</span>(statements[<span class="number">0</span>].to_string(), <span class="string">"SELECT x FROM foo"</span>);
<span class="macro">assert_eq!</span>(statements[<span class="number">1</span>].to_string(), <span class="string">"SELECT * FROM t"</span>);</code></pre></div></div></details></section></div></main></body></html>

5
sql/ast/index.html Normal file

File diff suppressed because one or more lines are too long

1
sql/ast/sidebar-items.js Normal file
View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"enum":["BinaryOperator","ColumnOption","DataType","Expr","FunctionArg","FunctionArgExpr","FunctionArguments","ObjectNamePart","SqlOption","TableConstraint","TimezoneInfo","Value"],"fn":["visit_expressions_mut","visit_statements_mut"],"struct":["ColumnDef","ColumnOptionDef","Function","Ident","ObjectName","ValueWithSpan"],"trait":["ObjectNamePartExt","Visit","VisitMut","Visitor","VisitorMut"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

246
sql/ast/struct.Ident.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `ObjectNamePartExt` trait in crate `sql`."><title>ObjectNamePartExt in sql::ast - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="sql" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">ObjectNamePartExt</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../sql/index.html">sql</a><span class="version">1.0.0-beta.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Object<wbr>Name<wbr>Part<wbr>Ext</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.to_string_unquoted" title="to_string_unquoted">to_string_unquoted</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In sql::<wbr>ast</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">sql</a>::<wbr><a href="index.html">ast</a></div><h1>Trait <span class="trait">Object<wbr>Name<wbr>Part<wbr>Ext</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/sql/ast.rs.html#22-24">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ObjectNamePartExt {
// Required method
fn <a href="#tymethod.to_string_unquoted" class="fn">to_string_unquoted</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>;
}</code></pre><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><section id="tymethod.to_string_unquoted" class="method"><a class="src rightside" href="../../src/sql/ast.rs.html#23">Source</a><h4 class="code-header">fn <a href="#tymethod.to_string_unquoted" class="fn">to_string_unquoted</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ObjectNamePartExt-for-ObjectNamePart" class="impl"><a class="src rightside" href="../../src/sql/ast.rs.html#26-34">Source</a><a href="#impl-ObjectNamePartExt-for-ObjectNamePart" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ObjectNamePartExt.html" title="trait sql::ast::ObjectNamePartExt">ObjectNamePartExt</a> for <a class="enum" href="enum.ObjectNamePart.html" title="enum sql::ast::ObjectNamePart">ObjectNamePart</a></h3></section></div><script src="../../trait.impl/sql/ast/trait.ObjectNamePartExt.js" data-ignore-extern-crates="sqlparser" async></script></section></div></main></body></html>

39
sql/ast/trait.Visit.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

119
sql/ast/trait.Visitor.html Normal file
View File

@@ -0,0 +1,119 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A visitor that can be used to walk an AST tree."><title>Visitor in sql::ast - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="sql" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Visitor</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../sql/index.html">sql</a><span class="version">1.0.0-beta.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Visitor</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#see-also" title="See also">See also</a></li><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Break" title="Break">Break</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.post_visit_expr" title="post_visit_expr">post_visit_expr</a></li><li><a href="#method.post_visit_query" title="post_visit_query">post_visit_query</a></li><li><a href="#method.post_visit_relation" title="post_visit_relation">post_visit_relation</a></li><li><a href="#method.post_visit_statement" title="post_visit_statement">post_visit_statement</a></li><li><a href="#method.post_visit_table_factor" title="post_visit_table_factor">post_visit_table_factor</a></li><li><a href="#method.post_visit_value" title="post_visit_value">post_visit_value</a></li><li><a href="#method.pre_visit_expr" title="pre_visit_expr">pre_visit_expr</a></li><li><a href="#method.pre_visit_query" title="pre_visit_query">pre_visit_query</a></li><li><a href="#method.pre_visit_relation" title="pre_visit_relation">pre_visit_relation</a></li><li><a href="#method.pre_visit_statement" title="pre_visit_statement">pre_visit_statement</a></li><li><a href="#method.pre_visit_table_factor" title="pre_visit_table_factor">pre_visit_table_factor</a></li><li><a href="#method.pre_visit_value" title="pre_visit_value">pre_visit_value</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In sql::<wbr>ast</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">sql</a>::<wbr><a href="index.html">ast</a></div><h1>Trait <span class="trait">Visitor</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait Visitor {
type <a href="#associatedtype.Break" class="associatedtype">Break</a>;
// Provided methods
fn <a href="#method.pre_visit_query" class="fn">pre_visit_query</a>(&amp;mut self, _query: &amp;Query) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_query" class="fn">post_visit_query</a>(&amp;mut self, _query: &amp;Query) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_relation" class="fn">pre_visit_relation</a>(
&amp;mut self,
_relation: &amp;<a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_relation" class="fn">post_visit_relation</a>(
&amp;mut self,
_relation: &amp;<a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_table_factor" class="fn">pre_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_table_factor" class="fn">post_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_expr" class="fn">pre_visit_expr</a>(&amp;mut self, _expr: &amp;<a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_expr" class="fn">post_visit_expr</a>(&amp;mut self, _expr: &amp;<a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_statement" class="fn">pre_visit_statement</a>(
&amp;mut self,
_statement: &amp;Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_statement" class="fn">post_visit_statement</a>(
&amp;mut self,
_statement: &amp;Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_value" class="fn">pre_visit_value</a>(&amp;mut self, _value: &amp;<a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_value" class="fn">post_visit_value</a>(&amp;mut self, _value: &amp;<a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A visitor that can be used to walk an AST tree.</p>
<p><code>pre_visit_</code> methods are invoked before visiting all children of the
node and <code>post_visit_</code> methods are invoked after visiting all
children of the node.</p>
<h2 id="see-also"><a class="doc-anchor" href="#see-also">§</a>See also</h2>
<p>These methods provide a more concise way of visiting nodes of a certain type:</p>
<ul>
<li>[visit_relations]</li>
<li>[visit_expressions]</li>
<li>[visit_statements]</li>
</ul>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// A structure that records statements and relations
</span><span class="attr">#[derive(Default)]
</span><span class="kw">struct </span>V {
visited: Vec&lt;String&gt;,
}
<span class="comment">// Visit relations and exprs before children are visited (depth first walk)
// Note you can also visit statements and visit exprs after children have been visited
</span><span class="kw">impl </span>Visitor <span class="kw">for </span>V {
<span class="kw">type </span>Break = ();
<span class="kw">fn </span>pre_visit_relation(<span class="kw-2">&amp;mut </span><span class="self">self</span>, relation: <span class="kw-2">&amp;</span>ObjectName) -&gt; ControlFlow&lt;<span class="self">Self</span>::Break&gt; {
<span class="self">self</span>.visited.push(<span class="macro">format!</span>(<span class="string">"PRE: RELATION: {}"</span>, relation));
ControlFlow::Continue(())
}
<span class="kw">fn </span>pre_visit_expr(<span class="kw-2">&amp;mut </span><span class="self">self</span>, expr: <span class="kw-2">&amp;</span>Expr) -&gt; ControlFlow&lt;<span class="self">Self</span>::Break&gt; {
<span class="self">self</span>.visited.push(<span class="macro">format!</span>(<span class="string">"PRE: EXPR: {}"</span>, expr));
ControlFlow::Continue(())
}
}
<span class="kw">let </span>sql = <span class="string">"SELECT a FROM foo where x IN (SELECT y FROM bar)"</span>;
<span class="kw">let </span>statements = Parser::parse_sql(<span class="kw-2">&amp;</span>GenericDialect{}, sql)
.unwrap();
<span class="comment">// Drive the visitor through the AST
</span><span class="kw">let </span><span class="kw-2">mut </span>visitor = V::default();
statements.visit(<span class="kw-2">&amp;mut </span>visitor);
<span class="comment">// The visitor has visited statements and expressions in pre-traversal order
</span><span class="kw">let </span>expected : Vec&lt;<span class="kw">_</span>&gt; = [
<span class="string">"PRE: EXPR: a"</span>,
<span class="string">"PRE: RELATION: foo"</span>,
<span class="string">"PRE: EXPR: x IN (SELECT y FROM bar)"</span>,
<span class="string">"PRE: EXPR: x"</span>,
<span class="string">"PRE: EXPR: y"</span>,
<span class="string">"PRE: RELATION: bar"</span>,
]
.into_iter().map(|s| s.to_string()).collect();
<span class="macro">assert_eq!</span>(visitor.visited, expected);</code></pre></div></div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Break" class="method"><h4 class="code-header">type <a href="#associatedtype.Break" class="associatedtype">Break</a></h4></section></summary><div class="docblock"><p>Type returned when the recursion returns early.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.pre_visit_query" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_query" class="fn">pre_visit_query</a>(&amp;mut self, _query: &amp;Query) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any queries that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_query" class="method"><h4 class="code-header">fn <a href="#method.post_visit_query" class="fn">post_visit_query</a>(&amp;mut self, _query: &amp;Query) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any queries that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_relation" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_relation" class="fn">pre_visit_relation</a>(
&amp;mut self,
_relation: &amp;<a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any relations (e.g. tables) that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_relation" class="method"><h4 class="code-header">fn <a href="#method.post_visit_relation" class="fn">post_visit_relation</a>(
&amp;mut self,
_relation: &amp;<a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any relations (e.g. tables) that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_table_factor" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_table_factor" class="fn">pre_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any table factors that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_table_factor" class="method"><h4 class="code-header">fn <a href="#method.post_visit_table_factor" class="fn">post_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any table factors that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_expr" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_expr" class="fn">pre_visit_expr</a>(&amp;mut self, _expr: &amp;<a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any expressions that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_expr" class="method"><h4 class="code-header">fn <a href="#method.post_visit_expr" class="fn">post_visit_expr</a>(&amp;mut self, _expr: &amp;<a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any expressions that appear in the AST</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_statement" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_statement" class="fn">pre_visit_statement</a>(
&amp;mut self,
_statement: &amp;Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any statements that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_statement" class="method"><h4 class="code-header">fn <a href="#method.post_visit_statement" class="fn">post_visit_statement</a>(
&amp;mut self,
_statement: &amp;Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any statements that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_value" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_value" class="fn">pre_visit_value</a>(&amp;mut self, _value: &amp;<a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any Value that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_value" class="method"><h4 class="code-header">fn <a href="#method.post_visit_value" class="fn">post_visit_value</a>(&amp;mut self, _value: &amp;<a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Break" title="type sql::ast::Visitor::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any Value that appear in the AST after visiting children</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/sqlparser/ast/visitor/trait.Visitor.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,112 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A visitor that can be used to mutate an AST tree."><title>VisitorMut in sql::ast - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="sql" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">VisitorMut</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../sql/index.html">sql</a><span class="version">1.0.0-beta.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Visitor<wbr>Mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#see-also" title="See also">See also</a></li><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Break" title="Break">Break</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.post_visit_expr" title="post_visit_expr">post_visit_expr</a></li><li><a href="#method.post_visit_query" title="post_visit_query">post_visit_query</a></li><li><a href="#method.post_visit_relation" title="post_visit_relation">post_visit_relation</a></li><li><a href="#method.post_visit_statement" title="post_visit_statement">post_visit_statement</a></li><li><a href="#method.post_visit_table_factor" title="post_visit_table_factor">post_visit_table_factor</a></li><li><a href="#method.post_visit_value" title="post_visit_value">post_visit_value</a></li><li><a href="#method.pre_visit_expr" title="pre_visit_expr">pre_visit_expr</a></li><li><a href="#method.pre_visit_query" title="pre_visit_query">pre_visit_query</a></li><li><a href="#method.pre_visit_relation" title="pre_visit_relation">pre_visit_relation</a></li><li><a href="#method.pre_visit_statement" title="pre_visit_statement">pre_visit_statement</a></li><li><a href="#method.pre_visit_table_factor" title="pre_visit_table_factor">pre_visit_table_factor</a></li><li><a href="#method.pre_visit_value" title="pre_visit_value">pre_visit_value</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In sql::<wbr>ast</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">sql</a>::<wbr><a href="index.html">ast</a></div><h1>Trait <span class="trait">Visitor<wbr>Mut</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait VisitorMut {
type <a href="#associatedtype.Break" class="associatedtype">Break</a>;
// Provided methods
fn <a href="#method.pre_visit_query" class="fn">pre_visit_query</a>(
&amp;mut self,
_query: &amp;mut Query,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_query" class="fn">post_visit_query</a>(
&amp;mut self,
_query: &amp;mut Query,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_relation" class="fn">pre_visit_relation</a>(
&amp;mut self,
_relation: &amp;mut <a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_relation" class="fn">post_visit_relation</a>(
&amp;mut self,
_relation: &amp;mut <a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_table_factor" class="fn">pre_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;mut TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_table_factor" class="fn">post_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;mut TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_expr" class="fn">pre_visit_expr</a>(&amp;mut self, _expr: &amp;mut <a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_expr" class="fn">post_visit_expr</a>(&amp;mut self, _expr: &amp;mut <a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_statement" class="fn">pre_visit_statement</a>(
&amp;mut self,
_statement: &amp;mut Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_statement" class="fn">post_visit_statement</a>(
&amp;mut self,
_statement: &amp;mut Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.pre_visit_value" class="fn">pre_visit_value</a>(
&amp;mut self,
_value: &amp;mut <a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.post_visit_value" class="fn">post_visit_value</a>(
&amp;mut self,
_value: &amp;mut <a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A visitor that can be used to mutate an AST tree.</p>
<p><code>pre_visit_</code> methods are invoked before visiting all children of the
node and <code>post_visit_</code> methods are invoked after visiting all
children of the node.</p>
<h2 id="see-also"><a class="doc-anchor" href="#see-also">§</a>See also</h2>
<p>These methods provide a more concise way of visiting nodes of a certain type:</p>
<ul>
<li>[visit_relations_mut]</li>
<li><a href="fn.visit_expressions_mut.html" title="fn sql::ast::visit_expressions_mut">visit_expressions_mut</a></li>
<li><a href="fn.visit_statements_mut.html" title="fn sql::ast::visit_statements_mut">visit_statements_mut</a></li>
</ul>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
<span class="comment">// A visitor that replaces "to_replace" with "replaced" in all expressions
</span><span class="kw">struct </span>Replacer;
<span class="comment">// Visit each expression after its children have been visited
</span><span class="kw">impl </span>VisitorMut <span class="kw">for </span>Replacer {
<span class="kw">type </span>Break = ();
<span class="kw">fn </span>post_visit_expr(<span class="kw-2">&amp;mut </span><span class="self">self</span>, expr: <span class="kw-2">&amp;mut </span>Expr) -&gt; ControlFlow&lt;<span class="self">Self</span>::Break&gt; {
<span class="kw">if let </span>Expr::Identifier(Ident{ value, ..}) = expr {
<span class="kw-2">*</span>value = value.replace(<span class="string">"to_replace"</span>, <span class="string">"replaced"</span>)
}
ControlFlow::Continue(())
}
}
<span class="kw">let </span>sql = <span class="string">"SELECT to_replace FROM foo where to_replace IN (SELECT to_replace FROM bar)"</span>;
<span class="kw">let </span><span class="kw-2">mut </span>statements = Parser::parse_sql(<span class="kw-2">&amp;</span>GenericDialect{}, sql).unwrap();
<span class="comment">// Drive the visitor through the AST
</span>statements.visit(<span class="kw-2">&amp;mut </span>Replacer);
<span class="macro">assert_eq!</span>(statements[<span class="number">0</span>].to_string(), <span class="string">"SELECT replaced FROM foo WHERE replaced IN (SELECT replaced FROM bar)"</span>);</code></pre></div></div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Break" class="method"><h4 class="code-header">type <a href="#associatedtype.Break" class="associatedtype">Break</a></h4></section></summary><div class="docblock"><p>Type returned when the recursion returns early.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.pre_visit_query" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_query" class="fn">pre_visit_query</a>(&amp;mut self, _query: &amp;mut Query) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any queries that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_query" class="method"><h4 class="code-header">fn <a href="#method.post_visit_query" class="fn">post_visit_query</a>(&amp;mut self, _query: &amp;mut Query) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any queries that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_relation" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_relation" class="fn">pre_visit_relation</a>(
&amp;mut self,
_relation: &amp;mut <a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any relations (e.g. tables) that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_relation" class="method"><h4 class="code-header">fn <a href="#method.post_visit_relation" class="fn">post_visit_relation</a>(
&amp;mut self,
_relation: &amp;mut <a class="struct" href="struct.ObjectName.html" title="struct sql::ast::ObjectName">ObjectName</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any relations (e.g. tables) that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_table_factor" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_table_factor" class="fn">pre_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;mut TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any table factors that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_table_factor" class="method"><h4 class="code-header">fn <a href="#method.post_visit_table_factor" class="fn">post_visit_table_factor</a>(
&amp;mut self,
_table_factor: &amp;mut TableFactor,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any table factors that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_expr" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_expr" class="fn">pre_visit_expr</a>(&amp;mut self, _expr: &amp;mut <a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any expressions that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_expr" class="method"><h4 class="code-header">fn <a href="#method.post_visit_expr" class="fn">post_visit_expr</a>(&amp;mut self, _expr: &amp;mut <a class="enum" href="enum.Expr.html" title="enum sql::ast::Expr">Expr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any expressions that appear in the AST</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_statement" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_statement" class="fn">pre_visit_statement</a>(
&amp;mut self,
_statement: &amp;mut Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any statements that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_statement" class="method"><h4 class="code-header">fn <a href="#method.post_visit_statement" class="fn">post_visit_statement</a>(
&amp;mut self,
_statement: &amp;mut Statement,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any statements that appear in the AST after visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_visit_value" class="method"><h4 class="code-header">fn <a href="#method.pre_visit_value" class="fn">pre_visit_value</a>(&amp;mut self, _value: &amp;mut <a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any value that appear in the AST before visiting children</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.post_visit_value" class="method"><h4 class="code-header">fn <a href="#method.post_visit_value" class="fn">post_visit_value</a>(&amp;mut self, _value: &amp;mut <a class="enum" href="enum.Value.html" title="enum sql::ast::Value">Value</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/ops/control_flow/enum.ControlFlow.html" title="enum core::ops::control_flow::ControlFlow">ControlFlow</a>&lt;Self::<a class="associatedtype" href="trait.VisitorMut.html#associatedtype.Break" title="type sql::ast::VisitorMut::Break">Break</a>&gt;</h4></section></summary><div class="docblock"><p>Invoked for any statements that appear in the AST after visiting children</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/sqlparser/ast/visitor/trait.VisitorMut.js" async></script></section></div></main></body></html>