Expand description
Transformation of an owned AST.
Each method of the Fold
trait is a hook that can be overridden to
customize the behavior when transforming the corresponding type of node. By
default, every method recursively transforms the substructure of the input
by invoking the right folder method on each of its fields.
pub trait Fold<T: AstInfo, T2: AstInfo> {
/* ... */
fn fold_function(&mut self, node: Function<T>) -> Function<T2> {
fold_function(self, node)
}
/* ... */
}
pub fn fold_function<F, T: AstInfo, T2: AstInfo>(folder: &mut F, node: Function<T>) -> Function<T2>
where
F: Fold<T, T2> + ?Sized,
{
Function {
name: folder.fold_item_name(node.name),
args: folder.fold_function_args(node.args),
filter: node.filter.map(|filter| Box::new(folder.fold_expr(*filter))),
over: node.over.map(|over| folder.fold_window_spec(over)),
distinct: node.distinct,
}
}
Of particular note to the fold transformation is its handling of the AST’s
generic parameter. The Fold
trait is defined so that references to T
in the input are replaced by references to T2
in the output. If
transformation of T
is not required, implement Fold
such that T
and
T2
refer to the same concrete type, and then provide trivial
implementations of any methods that fold T
’s associated types.
The FoldNode
trait is implemented for every node in the AST and can be
used to write generic functions that apply a Fold
implementation to any
node in the AST.
§Implementation notes
This module is automatically generated by the crate’s build script. Changes to the AST will be automatically propagated to the fold transformation.
This approach to AST transformations is inspired by the syn
crate. These
module docs are directly derived from the syn::fold
module docs.
Traits§
Functions§
- fold_
abbreviated_ grant_ or_ revoke_ statement - fold_
abbreviated_ grant_ statement - fold_
abbreviated_ revoke_ statement - fold_
alter_ cluster_ action - fold_
alter_ cluster_ statement - fold_
alter_ connection_ action - fold_
alter_ connection_ option - fold_
alter_ connection_ option_ name - fold_
alter_ connection_ statement - fold_
alter_ default_ privileges_ statement - fold_
alter_ index_ action - fold_
alter_ index_ statement - fold_
alter_ network_ policy_ statement - fold_
alter_ object_ rename_ statement - fold_
alter_ object_ swap_ statement - fold_
alter_ owner_ statement - fold_
alter_ retain_ history_ statement - fold_
alter_ role_ option - fold_
alter_ role_ statement - fold_
alter_ secret_ statement - fold_
alter_ set_ cluster_ statement - fold_
alter_ sink_ action - fold_
alter_ sink_ statement - fold_
alter_ source_ action - fold_
alter_ source_ add_ subsource_ option - fold_
alter_ source_ add_ subsource_ option_ name - fold_
alter_ source_ statement - fold_
alter_ system_ reset_ all_ statement - fold_
alter_ system_ reset_ statement - fold_
alter_ system_ set_ statement - fold_
alter_ table_ add_ column_ statement - fold_
as_ of - fold_
assignment - fold_
avro_ doc_ on - fold_
avro_ schema - fold_
avro_ schema_ option - fold_
avro_ schema_ option_ name - fold_
catalog_ name - fold_
close_ statement - fold_
cluster_ alter_ option - fold_
cluster_ alter_ option_ name - fold_
cluster_ alter_ option_ value - fold_
cluster_ alter_ until_ ready_ option - fold_
cluster_ alter_ until_ ready_ option_ name - fold_
cluster_ feature - fold_
cluster_ feature_ name - fold_
cluster_ option - fold_
cluster_ option_ name - fold_
cluster_ schedule_ option_ value - fold_
column_ def - fold_
column_ name - fold_
column_ option - fold_
column_ option_ def - fold_
column_ versioned - fold_
comment_ object_ type - fold_
comment_ statement - fold_
commit_ statement - fold_
connection_ default_ aws_ privatelink - fold_
connection_ option - fold_
connection_ option_ name - fold_
continual_ task_ option - fold_
continual_ task_ option_ name - fold_
continual_ task_ stmt - fold_
copy_ direction - fold_
copy_ option - fold_
copy_ option_ name - fold_
copy_ relation - fold_
copy_ statement - fold_
copy_ target - fold_
create_ cluster_ replica_ statement - fold_
create_ cluster_ statement - fold_
create_ connection_ option - fold_
create_ connection_ option_ name - fold_
create_ connection_ statement - fold_
create_ connection_ type - fold_
create_ continual_ task_ statement - fold_
create_ continual_ task_ sugar - fold_
create_ database_ statement - fold_
create_ index_ statement - fold_
create_ materialized_ view_ statement - fold_
create_ network_ policy_ statement - fold_
create_ role_ statement - fold_
create_ schema_ statement - fold_
create_ secret_ statement - fold_
create_ sink_ connection - fold_
create_ sink_ option - fold_
create_ sink_ option_ name - fold_
create_ sink_ statement - fold_
create_ source_ connection - fold_
create_ source_ option - fold_
create_ source_ option_ name - fold_
create_ source_ statement - fold_
create_ subsource_ option - fold_
create_ subsource_ option_ name - fold_
create_ subsource_ statement - fold_
create_ table_ from_ source_ statement - fold_
create_ table_ statement - fold_
create_ type_ as - fold_
create_ type_ list_ option - fold_
create_ type_ list_ option_ name - fold_
create_ type_ map_ option - fold_
create_ type_ map_ option_ name - fold_
create_ type_ statement - fold_
create_ view_ statement - fold_
create_ webhook_ source_ body - fold_
create_ webhook_ source_ check - fold_
create_ webhook_ source_ check_ options - fold_
create_ webhook_ source_ filter_ header - fold_
create_ webhook_ source_ header - fold_
create_ webhook_ source_ include_ headers - fold_
create_ webhook_ source_ map_ header - fold_
create_ webhook_ source_ secret - fold_
create_ webhook_ source_ statement - fold_
csr_ config_ option - fold_
csr_ config_ option_ name - fold_
csr_ connection - fold_
csr_ connection_ avro - fold_
csr_ connection_ protobuf - fold_
csr_ seed_ avro - fold_
csr_ seed_ protobuf - fold_
csr_ seed_ protobuf_ schema - fold_
csv_ columns - fold_
cte - fold_
cte_ block - fold_
cte_ mut_ rec - fold_
cte_ mut_ rec_ column_ def - fold_
date_ time_ field - fold_
deallocate_ statement - fold_
declare_ statement - fold_
deferred_ item_ name - fold_
delete_ statement - fold_
discard_ statement - fold_
discard_ target - fold_
distinct - fold_
doc_ on_ identifier - fold_
doc_ on_ schema - fold_
drop_ objects_ statement - fold_
drop_ owned_ statement - fold_
execute_ statement - fold_
explain_ format - fold_
explain_ plan_ option - fold_
explain_ plan_ option_ name - fold_
explain_ plan_ statement - fold_
explain_ pushdown_ statement - fold_
explain_ sink_ schema_ for - fold_
explain_ sink_ schema_ statement - fold_
explain_ stage - fold_
explain_ timestamp_ statement - fold_
explainee - fold_
expr - fold_
external_ reference_ export - fold_
external_ references - fold_
fetch_ direction - fold_
fetch_ option - fold_
fetch_ option_ name - fold_
fetch_ statement - fold_
format - fold_
format_ specifier - fold_
function - fold_
function_ args - fold_
grant_ privileges_ statement - fold_
grant_ role_ statement - fold_
grant_ target_ all_ specification - fold_
grant_ target_ specification - fold_
grant_ target_ specification_ inner - fold_
homogenizing_ function - fold_
ident - fold_
ident_ error - fold_
if_ exists_ behavior - fold_
index_ option - fold_
index_ option_ name - fold_
insert_ source - fold_
insert_ statement - fold_
inspect_ shard_ statement - fold_
interval_ value - fold_
is_ expr_ construct - fold_
join - fold_
join_ constraint - fold_
join_ operator - fold_
kafka_ broker - fold_
kafka_ broker_ aws_ privatelink - fold_
kafka_ broker_ aws_ privatelink_ option - fold_
kafka_ broker_ aws_ privatelink_ option_ name - fold_
kafka_ broker_ tunnel - fold_
kafka_ sink_ config_ option - fold_
kafka_ sink_ config_ option_ name - fold_
kafka_ sink_ key - fold_
kafka_ source_ config_ option - fold_
kafka_ source_ config_ option_ name - fold_
key_ constraint - fold_
limit - fold_
load_ generator - fold_
load_ generator_ option - fold_
load_ generator_ option_ name - fold_
map_ entry - fold_
materialized_ view_ option - fold_
materialized_ view_ option_ name - fold_
mut_ rec_ block - fold_
mut_ rec_ block_ option - fold_
mut_ rec_ block_ option_ name - fold_
my_ sql_ config_ option - fold_
my_ sql_ config_ option_ name - fold_
named_ plan - fold_
network_ policy_ option - fold_
network_ policy_ option_ name - fold_
network_ policy_ rule_ definition - fold_
network_ policy_ rule_ option - fold_
network_ policy_ rule_ option_ name - fold_
notice_ severity - fold_
object_ type - fold_op
- fold_
order_ by_ expr - fold_
pg_ config_ option - fold_
pg_ config_ option_ name - fold_
prepare_ statement - fold_
privilege - fold_
privilege_ specification - fold_
protobuf_ schema - fold_
qualified_ replica - fold_
query - fold_
raise_ statement - fold_
reader_ schema_ selection_ strategy - fold_
reassign_ owned_ statement - fold_
refresh_ at_ option_ value - fold_
refresh_ every_ option_ value - fold_
refresh_ option_ value - fold_
replica_ definition - fold_
replica_ option - fold_
replica_ option_ name - fold_
reset_ variable_ statement - fold_
revoke_ privileges_ statement - fold_
revoke_ role_ statement - fold_
role_ attribute - fold_
rollback_ statement - fold_
schema - fold_
select - fold_
select_ item - fold_
select_ option - fold_
select_ option_ name - fold_
select_ statement - fold_
set_ expr - fold_
set_ operator - fold_
set_ role_ var - fold_
set_ transaction_ statement - fold_
set_ variable_ statement - fold_
set_ variable_ to - fold_
set_ variable_ value - fold_
show_ columns_ statement - fold_
show_ create_ cluster_ statement - fold_
show_ create_ connection_ statement - fold_
show_ create_ index_ statement - fold_
show_ create_ materialized_ view_ statement - fold_
show_ create_ sink_ statement - fold_
show_ create_ source_ statement - fold_
show_ create_ table_ statement - fold_
show_ create_ view_ statement - fold_
show_ object_ type - fold_
show_ objects_ statement - fold_
show_ statement - fold_
show_ statement_ filter - fold_
show_ variable_ statement - fold_
sink_ envelope - fold_
source_ envelope - fold_
source_ error_ policy - fold_
source_ include_ metadata - fold_
sql_ server_ config_ option - fold_
sql_ server_ config_ option_ name - fold_
start_ transaction_ statement - fold_
statement - fold_
subscribe_ option - fold_
subscribe_ option_ name - fold_
subscribe_ output - fold_
subscribe_ relation - fold_
subscribe_ statement - fold_
subscript_ position - fold_
system_ object_ type - fold_
table_ alias - fold_
table_ constraint - fold_
table_ factor - fold_
table_ from_ source_ columns - fold_
table_ from_ source_ option - fold_
table_ from_ source_ option_ name - fold_
table_ option - fold_
table_ option_ name - fold_
table_ with_ joins - fold_
target_ role_ specification - fold_
transaction_ access_ mode - fold_
transaction_ isolation_ level - fold_
transaction_ mode - fold_
unresolved_ database_ name - fold_
unresolved_ item_ name - fold_
unresolved_ object_ name - fold_
unresolved_ schema_ name - fold_
update_ statement - fold_
validate_ connection_ statement - fold_
value - fold_
value_ error - fold_
values - fold_
version - fold_
view_ definition - fold_
window_ frame - fold_
window_ frame_ bound - fold_
window_ frame_ units - fold_
window_ spec - fold_
with_ option_ value