unless (@clauses) {
return @{$self->{clauses_of}{$of}||[]};
}
+ if (ref($clauses[0]) eq 'CODE') {
+ @clauses = $self->${\($clauses[0])}(@{$self->{clauses_of}{$of}||[]});
+ }
$self->{clauses_of}{$of} = \@clauses;
return $self;
}
$self->expander(as => '_expand_op_as');
$self->renderer(as => '_render_as');
- splice(@{$self->{clauses_of}{update}}, 2, 0, 'from');
- splice(@{$self->{clauses_of}{delete}}, 1, 0, 'using');
+ $self->clauses_of(update => sub {
+ my ($self, @clauses) = @_;
+ splice(@clauses, 2, 0, 'from');
+ @clauses;
+ });
+
+ $self->clauses_of(delete => sub {
+ my ($self, @clauses) = @_;
+ splice(@clauses, 1, 0, 'using');
+ @clauses;
+ });
+
$self->clause_expanders(
'update.from' => '_expand_select_clause_from',
'delete.using' => sub {