pub struct Column {Show 28 fields
pub name: String,
pub ty: SqlType,
pub primary_key: bool,
pub nullable: bool,
pub fk_target: Option<String>,
pub noform: bool,
pub db_constraint: bool,
pub noedit: bool,
pub is_string_repr: bool,
pub max_length: u32,
pub choices: Vec<String>,
pub choice_labels: Vec<String>,
pub default: String,
pub is_multichoice: bool,
pub unique: bool,
pub on_delete: FkAction,
pub on_update: FkAction,
pub index: bool,
pub auto_now_add: bool,
pub auto_now: bool,
pub help: String,
pub example: String,
pub widget: Option<String>,
pub supported_backends: Vec<String>,
pub min: Option<i64>,
pub max: Option<i64>,
pub text_format: Option<String>,
pub slug_from: Option<String>,
}Expand description
One column inside a Operation::CreateTable.
Mirrors the structure of FieldSpec but is fully owned for
serialisation. Reconstructed from a FieldSpec at diff time.
Fields§
§name: String§ty: SqlType§primary_key: bool§nullable: bool§fk_target: Option<String>For SqlType::ForeignKey columns: the SQL table name of the
referenced model. None for all non-FK columns.
noform: boolWhen true, this field is never shown on any admin form (create or
edit). Propagated from FieldSpec::noform.
db_constraint: boolFor FK columns: whether to emit a physical FOREIGN KEY ... REFERENCES constraint. Propagated from FieldSpec::db_constraint.
false (set via #[umbral(db_constraint = false)]) keeps the
logical FK (column + fk_target) but renders no REFERENCES
clause — the only valid shape for a cross-database FK. Closes
gaps2 #22. Defaults to true so existing migration JSON
round-trips unchanged (omitted from JSON when at its default).
noedit: boolWhen true, this field appears on the edit form as read-only.
Propagated from FieldSpec::noedit.
is_string_repr: boolDisplay-string marker — propagated from
FieldSpec::is_string_repr. The admin uses the first column
with this flag as the default list_display label when no
explicit one is configured.
max_length: u32Display truncation cap — propagated from FieldSpec::max_length.
0 means no truncation.
choices: Vec<String>Closed-set DB values for a choices column. Propagated from
FieldSpec::choices. Non-empty when the model field carries
#[umbral(choices)]; the migration engine emits a Postgres
CHECK (col IN (...)) constraint when this slice is non-empty.
Empty for every non-choices column.
choice_labels: Vec<String>Human labels matching choices position-for-position. Carried
alongside choices so the admin’s <select> widget has labels
without the runtime needing to reflect on the model type.
default: StringSQL DEFAULT value — propagated from FieldSpec::default.
Empty string means no default. The migration engine reads this
at DDL-emit time for both CREATE TABLE and ALTER TABLE ADD COLUMN. Set via #[umbral(default = "...")] on the model field.
is_multichoice: boolDistinguishes a multi-valued MultiChoice<E> column from a
single-valued choices column. Both share ty: Text plus the same
choices / choice_labels metadata; this flag is the only
signal that the value is a CSV. Empty / false for every other
column.
unique: boolCarries FieldSpec::unique into the migration snapshot. The
DDL builders emit a UNIQUE clause on this column at
CREATE TABLE time when set. Default false keeps existing
migration JSON files round-tripping unchanged (the field is
omitted on serialise when default).
on_delete: FkActionCarries FieldSpec::on_delete into the migration snapshot.
FK columns only — the DDL builders emit
ON DELETE <action> when this is anything other than
NoAction. Default NoAction is omitted from JSON so
existing migration files round-trip without churn.
on_update: FkActionCarries FieldSpec::on_update into the migration snapshot.
Same shape as on_delete; emits ON UPDATE <action>.
index: boolCarries FieldSpec::index into the migration snapshot. The
CreateTable + AddColumn render paths emit a matching
CREATE INDEX idx_<table>_<col> for every column whose
flag is set. Default false keeps existing migration JSON
round-tripping unchanged.
auto_now_add: boolCarries FieldSpec::auto_now_add into the migration
snapshot. The dynamic write path (DynQuerySet::insert_json)
auto-populates the column with Utc::now() when the body
omits it. Default false so existing migration JSON
round-trips unchanged.
auto_now: boolCarries FieldSpec::auto_now into the migration snapshot.
Same shape as auto_now_add but fires on update too.
help: StringCarries FieldSpec::help into the migration snapshot.
Default empty string is omitted from JSON so existing
migration files round-trip unchanged.
example: StringCarries FieldSpec::example into the migration snapshot.
Same shape as help.
widget: Option<String>Carries FieldSpec::widget into the migration snapshot — the
form-renderer presentation hint (features.md #4). Presentation
only, no DB effect, so it’s excluded from the schema diff the
same way help / example are. None is omitted from JSON so
existing migration files round-trip unchanged.
supported_backends: Vec<String>Carries FieldSpec::supported_backends into the migration
snapshot. When non-empty, the boot system check rejects the
model on any backend not listed. Closes IMP-5 from
bugs/tests/testBugs.md. Default empty (works on every
backend); JSON skip-when-empty so existing migration files
don’t churn.
min: Option<i64>IMP-3: numeric lower bound. None means “no minimum”; the
DDL emits a CHECK (col >= N) constraint when set.
max: Option<i64>IMP-3: numeric upper bound. Same shape as min.
text_format: Option<String>BUG-11/12/13: constrained-text marker. None is plain text;
Some("slug" | "email" | "url") flags the column as a
Slug / Email / Url wrapper. OpenAPI emits the
corresponding format / pattern; the REST plugin
pre-validates the body via validate_text_format.
slug_from: Option<String>Gap 109: auto-derive source. When Some("title"), the slug is
computed from the row’s title column at write time if the
slug column itself is empty / missing on the body. Pure
runtime behaviour — has no DDL effect, so the diff engine
ignores changes to this field. #[serde(default)] keeps
older snapshots round-tripping.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Column
impl<'de> Deserialize<'de> for Column
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Column
Source§impl From<&IntrospectedColumn> for Column
impl From<&IntrospectedColumn> for Column
Source§fn from(c: &IntrospectedColumn) -> Self
fn from(c: &IntrospectedColumn) -> Self
impl StructuralPartialEq for Column
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
impl UnwindSafe for Column
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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);