mod actions;
pub use actions::{
MutationRuleInput, OwnedInsertRuleQueries, OwnedMutationRuleInput, OwnedRuleQueryInput,
OwnedRuleQueryResolver, RuleAction, RuleInputColumns, RuleMutation, RuleQueryInput,
RuleQueryResolver,
};
pub struct RuleColumnMetadata {
pub ty: crate::ast::ColumnType,
pub collation_oid: Option<u32>,
}
impl RuleColumnMetadata {
pub fn bind_input(&self, expression: crate::ScalarExpr) -> crate::ScalarExpr {
if !crate::schema::composites::type_is_collatable(&self.ty) {
return expression;
}
let oid = self.collation_oid.unwrap_or_else(|| {
u32::try_from(crate::catalog::type_metadata::pg_type_collation_oid(
&self.ty,
))
.expect("type collation identity")
});
crate::ScalarExpr::Collated {
expr: Box::new(expression),
ty: self.ty.clone(),
collation: crate::ir::ResultCollation::new(
crate::catalog::collations::derivation::Derivation::implicit(i64::from(oid)),
oid,
),
}
}
}