pub enum DataType {
Show 24 variants
Bool,
S8,
S16,
S32,
S64,
F32,
F64,
U8,
U16,
U32,
U64,
I8,
I16,
I32,
I64,
Uuid,
UuidRand,
UuidSlug,
Utc,
Text,
Ident,
Url,
Json,
Bytes,
}Expand description
restq supports comprehensive data types
based on rust and postgresql type, combined together
format: <data_type>?
? - indicates it is optional, nullable in database context
example:
text? - nullable text
text(8..) - text with at least 8 characters long
text(..255) - text must not be more than 255 characters long.
u32(1) - u32 with default value of 1
u32(>10) - check value should be greater than 10
u32(10<column<=20) - check the value should be greater than 10 and less than or equal to 20
u32(<discount) - check value should be lesser than discount column
f32(0.0) - f32 with 0.0 as the default value
Variants§
Bool
bool
S8
8 bit serial integer
S16
16 bit serial integer
S32
32 bit serial integer
S64
64 bit serial integer
F32
f32
F64
f64
U8
u8
U16
u16
U32
u32
U64
u64
I8
i8
I16
i16
I32
i32
I64
i64
Uuid
Uuid, no default specified
UuidRand
Uuid with random as the default
UuidSlug
create a new uuid and generate a url friendly base64 using blob_uuid
Utc
Utc time with now as the default
Text
text/strings, generic text, no interpretation
Ident
A valid identifier string defined by begining of alpha_or_underscore character and optionally followed by alphnumeric characters
Url
A valid url
Json
json type
Bytes
bytes
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DataType
impl<'de> Deserialize<'de> for DataType
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 DataType
impl StructuralPartialEq for DataType
Auto Trait Implementations§
impl Freeze for DataType
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnwindSafe for DataType
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> 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