pub struct DatasetSchema {
pub name: String,
pub columns: Vec<ColumnInfo>,
pub by_name: HashMap<String, usize>,
pub predicate_filter: ColumnFilter,
pub projection_filter: ColumnFilter,
}Fields§
§name: String§columns: Vec<ColumnInfo>§by_name: HashMap<String, usize>lowercase name → index in columns.
predicate_filter: ColumnFilterColumns a caller may filter on. Empty = no restriction.
projection_filter: ColumnFilterColumns a caller may see / return. Columns denied here are hidden as if they did not exist. Empty = no restriction.
Implementations§
Source§impl DatasetSchema
impl DatasetSchema
pub fn new(name: impl Into<String>, columns: Vec<ColumnInfo>) -> Self
Sourcepub fn with_filters(
self,
predicate_filter: ColumnFilter,
projection_filter: ColumnFilter,
) -> Result<Self, AppError>
pub fn with_filters( self, predicate_filter: ColumnFilter, projection_filter: ColumnFilter, ) -> Result<Self, AppError>
Attach column-level access filters, validating that every name they list actually exists in the schema. A typo in a denylist would otherwise silently expose a column, so unknown names are a hard error at registration time.
Sourcepub fn has_column_filters(&self) -> bool
pub fn has_column_filters(&self) -> bool
Whether either access filter restricts anything.
Sourcepub fn is_visible(&self, name: &str) -> bool
pub fn is_visible(&self, name: &str) -> bool
Whether col (any case) is visible under the projection filter.
Columns absent from the schema are reported as not visible.
Sourcepub fn visible_columns(&self) -> Vec<&ColumnInfo>
pub fn visible_columns(&self) -> Vec<&ColumnInfo>
The columns visible under the projection filter, in schema order.
Sourcepub fn find(&self, name: &str) -> Result<&ColumnInfo, AppError>
pub fn find(&self, name: &str) -> Result<&ColumnInfo, AppError>
Case-insensitive lookup. Returns the canonical ColumnInfo.
Sourcepub fn find_visible(&self, name: &str) -> Result<&ColumnInfo, AppError>
pub fn find_visible(&self, name: &str) -> Result<&ColumnInfo, AppError>
Like find, but a column hidden by the projection
filter is reported as UnknownColumn — hidden columns must not be
distinguishable from ones that never existed.
Sourcepub fn find_for_predicate(&self, name: &str) -> Result<&ColumnInfo, AppError>
pub fn find_for_predicate(&self, name: &str) -> Result<&ColumnInfo, AppError>
Resolve a column referenced by a predicate: it must be visible
(hidden columns → UnknownColumn) and allowed by the predicate
filter (otherwise Forbidden).
Sourcepub fn quote_ident(name: &str) -> String
pub fn quote_ident(name: &str) -> String
Quoted identifier safe for WHERE / SELECT clauses.
Double-quotes embedded " per SQL spec.
Trait Implementations§
Source§impl Clone for DatasetSchema
impl Clone for DatasetSchema
Source§fn clone(&self) -> DatasetSchema
fn clone(&self) -> DatasetSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more