#[non_exhaustive]pub struct Conventions {
pub tenant_column: Option<String>,
pub tenant_setting: Option<String>,
pub user_setting: Option<String>,
pub soft_delete_column: Option<String>,
pub managed_columns: Vec<String>,
pub version_column: Option<String>,
}Expand description
Opt-in conventions: columns that mean the same thing in every table that has them (ADR 0010). Each convention applies only to the tables that have the named column, and all are off by default.
let mut conventions = rok_sqlc::Conventions::rok();
conventions.soft_delete_column = Some("removed_at".into());
let mut config = rok_sqlc::Config::default();
config.conventions = conventions;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tenant_column: Option<String>The tenant column, which scopes every generated operation on a table to one tenant given by the caller.
tenant_setting: Option<String>The PostgreSQL setting the generated session helper sets to the current tenant, for row-level security policies.
user_setting: Option<String>The PostgreSQL setting the generated session helper sets to the acting user, for audit triggers.
soft_delete_column: Option<String>The soft-delete column: a nullable timestamp recording when a row was deleted.
managed_columns: Vec<String>Managed columns, maintained by the database (defaults and triggers): left out of create inputs and update patches, kept in rows.
version_column: Option<String>The version column, for optimistic concurrency on update.
Implementations§
Source§impl Conventions
impl Conventions
Sourcepub const PRESETS: &[&str]
pub const PRESETS: &[&str]
The preset names Conventions::preset knows.
Sourcepub fn rok() -> Self
pub fn rok() -> Self
The Rok ERP’s conventions: tenant column organization_id (with the
settings app.organization_id and app.user_id), soft-delete column
deleted_at, managed columns updated_at and row_version, and
version column row_version.
Sourcepub fn preset(name: &str) -> Option<Self>
pub fn preset(name: &str) -> Option<Self>
The preset with this name (one of Conventions::PRESETS), or
None for an unknown name.