pub struct ViewDescriptor<V, PK> {
pub schema_name: &'static str,
pub view_name: &'static str,
pub columns: &'static [ModelColumn],
pub primary_key: &'static str,
pub allowed_fields: &'static [&'static str],
pub allowed_sorts: &'static [&'static str],
pub read_allow_policies: &'static [ReadPolicy],
pub read_deny_policies: &'static [ReadPolicy],
pub detail_allow_policies: &'static [ReadPolicy],
pub detail_deny_policies: &'static [ReadPolicy],
pub is_materialized: bool,
pub source_tables: &'static [&'static str],
/* private fields */
}Fields§
§schema_name: &'static str§view_name: &'static str§columns: &'static [ModelColumn]§primary_key: &'static strSQL column name of the view’s primary key. Empty string when
the view was declared @@no_unique — in that case the macro
also omits find_unique on the generated delegate.
allowed_fields: &'static [&'static str]§allowed_sorts: &'static [&'static str]§read_allow_policies: &'static [ReadPolicy]§read_deny_policies: &'static [ReadPolicy]§detail_allow_policies: &'static [ReadPolicy]§detail_deny_policies: &'static [ReadPolicy]§is_materialized: booltrue when the view was declared @@materialized. Embedded
builds reject this at macro expansion time (SQLite has no
materialized views); server builds emit a refresh() method.
source_tables: &'static [&'static str]Names of the models / views the SQL body reads from. Drives
migration ordering — CREATE VIEW lands after its sources,
DROP VIEW lands before them. Populated from the from M, N
declaration on the schema, not parsed out of the SQL body.
Implementations§
Source§impl<V, PK> ViewDescriptor<V, PK>
impl<V, PK> ViewDescriptor<V, PK>
pub const fn new( schema_name: &'static str, view_name: &'static str, columns: &'static [ModelColumn], primary_key: &'static str, allowed_fields: &'static [&'static str], allowed_sorts: &'static [&'static str], read_allow_policies: &'static [ReadPolicy], read_deny_policies: &'static [ReadPolicy], detail_allow_policies: &'static [ReadPolicy], detail_deny_policies: &'static [ReadPolicy], is_materialized: bool, source_tables: &'static [&'static str], ) -> ViewDescriptor<V, PK>
Trait Implementations§
Source§impl<V, PK> Clone for ViewDescriptor<V, PK>
impl<V, PK> Clone for ViewDescriptor<V, PK>
Source§fn clone(&self) -> ViewDescriptor<V, PK>
fn clone(&self) -> ViewDescriptor<V, PK>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<V, PK> Debug for ViewDescriptor<V, PK>
impl<V, PK> Debug for ViewDescriptor<V, PK>
Source§impl<V, PK> ReadSource<V, PK> for ViewDescriptor<V, PK>
impl<V, PK> ReadSource<V, PK> for ViewDescriptor<V, PK>
Source§fn schema_name(&self) -> &'static str
fn schema_name(&self) -> &'static str
datasource db { ... };
kept on the trait so future per-source schemas (e.g. analytics
views in a dedicated schema) are a non-breaking change.Source§fn table_name(&self) -> &'static str
fn table_name(&self) -> &'static str
FROM
clauses.Source§fn columns(&self) -> &'static [ModelColumn]
fn columns(&self) -> &'static [ModelColumn]
Source§fn primary_key(&self) -> &'static str
fn primary_key(&self) -> &'static str
@@no_unique (ADR-0003 §“Schema surface”) this is the empty
string — find_unique is not emitted on the delegate so the
builder never reads this slot.Source§fn allowed_fields(&self) -> &'static [&'static str]
fn allowed_fields(&self) -> &'static [&'static str]
where = { <name>: <op> } filter payloads
— the same allow-list the model uses for read-policy scoping.Source§fn allowed_includes(&self) -> &'static [&'static str]
fn allowed_includes(&self) -> &'static [&'static str]
include = { <name>: ... } payloads. Empty
on views in v1 (relation-follow off a view is out of scope —
see ADR-0003 “Deferred”).Source§fn allowed_sorts(&self) -> &'static [&'static str]
fn allowed_sorts(&self) -> &'static [&'static str]
orderBy = [ <name>, ... ] payloads.Source§fn read_allow_policies(&self) -> &'static [ReadPolicy]
fn read_allow_policies(&self) -> &'static [ReadPolicy]
@@allow("read", ...) policy literals for the list / search
shape (returns one row per matching record).Source§fn read_deny_policies(&self) -> &'static [ReadPolicy]
fn read_deny_policies(&self) -> &'static [ReadPolicy]
@@deny("read", ...) policy literals for the list shape.Source§fn detail_allow_policies(&self) -> &'static [ReadPolicy]
fn detail_allow_policies(&self) -> &'static [ReadPolicy]
@@allow("read", ...) policy literals for the detail shape
(find_unique — returns at most one record). Models can carry
stricter detail policies than list ones; views inherit a
single set declared via @@allow("read", ...) on the view
itself.Source§fn detail_deny_policies(&self) -> &'static [ReadPolicy]
fn detail_deny_policies(&self) -> &'static [ReadPolicy]
@@deny("read", ...) policy literals for the detail shape.Source§fn soft_delete_column(&self) -> Option<&'static str>
fn soft_delete_column(&self) -> Option<&'static str>
None on views (and on
models without @@soft_delete), in which case the read
builder skips the <col> IS NULL predicate it would otherwise
inject.Source§fn select_projection(&self) -> String
fn select_projection(&self) -> String
<col> AS "<alias>", ... projection list the
builder splices into SELECT. The default impl delegates to
Self::columns so any descriptor that just stores a column
list gets a working projection for free.Source§fn select_projection_subset(&self, columns: &[&str]) -> String
fn select_projection_subset(&self, columns: &[&str]) -> String
Self::select_projection but emits only the named
columns. Unknown names are silently dropped — same contract
as super::ModelDescriptor::select_projection_subset.impl<V, PK> Copy for ViewDescriptor<V, PK>
Auto Trait Implementations§
impl<V, PK> Freeze for ViewDescriptor<V, PK>
impl<V, PK> RefUnwindSafe for ViewDescriptor<V, PK>
impl<V, PK> Send for ViewDescriptor<V, PK>
impl<V, PK> Sync for ViewDescriptor<V, PK>
impl<V, PK> Unpin for ViewDescriptor<V, PK>
impl<V, PK> UnsafeUnpin for ViewDescriptor<V, PK>
impl<V, PK> UnwindSafe for ViewDescriptor<V, PK>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);