pub struct FieldSchema {
pub name: &'static str,
pub column: &'static str,
pub ty: FieldType,
pub nullable: bool,
pub primary_key: bool,
pub relation: Option<Relation>,
pub max_length: Option<u32>,
pub min: Option<i64>,
pub max: Option<i64>,
pub default: Option<&'static str>,
pub auto: bool,
pub unique: bool,
}Expand description
Static description of a single column on a model.
max_length, min, max carry per-field bounds populated from
#[rustango(max_length = …, min = …, max = …)]. The query layer
uses them to validate writes; the migration writer uses them to
emit VARCHAR(N) and CHECK constraints.
default is the raw SQL fragment placed after DEFAULT in DDL
(e.g. "0", "'draft'", "NOW()"). Set via
#[rustango(default = "…")]. The string is inserted verbatim — it
is the developer’s responsibility to write a valid Postgres
expression and to quote string literals themselves.
Fields§
§name: &'static str§column: &'static str§ty: FieldType§nullable: bool§primary_key: bool§relation: Option<Relation>§max_length: Option<u32>Maximum string length in characters. Only meaningful for FieldType::String.
min: Option<i64>Inclusive integer lower bound. Only meaningful for I32/I64.
max: Option<i64>Inclusive integer upper bound. Only meaningful for I32/I64.
default: Option<&'static str>Raw SQL expression for the column’s DEFAULT clause, if any.
auto: booltrue for fields whose Rust type is Auto<T> — server-assigned
PKs that translate to BIGSERIAL / SERIAL and skip the column
from explicit INSERTs when Auto::Unset so Postgres’ DEFAULT
fires. The migration writer reads this; the Auto::Unset → SQL DEFAULT translation happens in the macro-generated INSERT path.
unique: booltrue when #[rustango(unique)] is present. The DDL writer emits
UNIQUE inline on the column definition.
Trait Implementations§
Source§impl Clone for FieldSchema
impl Clone for FieldSchema
Source§fn clone(&self) -> FieldSchema
fn clone(&self) -> FieldSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldSchema
impl Debug for FieldSchema
impl Copy for FieldSchema
Auto Trait Implementations§
impl Freeze for FieldSchema
impl RefUnwindSafe for FieldSchema
impl Send for FieldSchema
impl Sync for FieldSchema
impl Unpin for FieldSchema
impl UnsafeUnpin for FieldSchema
impl UnwindSafe for FieldSchema
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> 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 more