Struct datamodel_renderer::datamodel::DefaultValue
source · pub struct DefaultValue<'a>(/* private fields */);
Expand description
A field default value.
Implementations§
source§impl<'a> DefaultValue<'a>
impl<'a> DefaultValue<'a>
sourcepub fn function(function: Function<'a>) -> Self
pub fn function(function: Function<'a>) -> Self
A function default value.
ⓘ
model Foo {
field String @default(uuid())
^^^^ this
}
sourcepub fn text(value: impl Into<Cow<'a, str>>) -> Self
pub fn text(value: impl Into<Cow<'a, str>>) -> Self
A textual default value.
ⓘ
model Foo {
field String @default("meow")
^^^^ this
}
sourcepub fn bytes(value: impl Into<Cow<'a, [u8]>>) -> Self
pub fn bytes(value: impl Into<Cow<'a, [u8]>>) -> Self
A byte array default value, base64-encoded.
ⓘ
model Foo {
field String @default("deadbeef")
^^^^^^^^ this
}
sourcepub fn constant<T>(value: T) -> Selfwhere
T: Display + 'a,
pub fn constant<T>(value: T) -> Selfwhere T: Display + 'a,
A constant default value.
ⓘ
model Foo {
field String @default(666420)
^^^^^^ this
}
Trait Implementations§
source§impl<'a> Debug for DefaultValue<'a>
impl<'a> Debug for DefaultValue<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for DefaultValue<'a>
impl<'a> Send for DefaultValue<'a>
impl<'a> Sync for DefaultValue<'a>
impl<'a> Unpin for DefaultValue<'a>
impl<'a> UnwindSafe for DefaultValue<'a>
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
Mutably borrows from an owned value. Read more