[−][src]Enum dbcrossbarlib::schema::DataType
The data type of a column.
This is a rather interesting type: It only exists to provide a reasonable set of "interchange" types, that we might want to preserve when moving from on database to another. So it's less precise than PostgreSQL's built-in types, but more precise than BigQuery's built-in types. It exists to be a "happy medium"--every output driver should be able to understand every one of these types meaningfully, and it should almost always be able to map it to something in the local database.
Essentially, this fulfills a similar role to the standard JSON types (number, string, array, map, boolean, etc.). It's an interchange format. It's not supposed to cover every imaginable type. But it should at least cover common, generic types that make sense to many database backends.
We represent this as a Rust enum
, and not a class hierarchy, because:
- Class hierarchies provide an extensible set of types (subclasses), but a closed set of operations (instance methods on the root class).
- Rust
enum
s provide a closed set of types (enum
variants), but an open set of operations (match
statements matching each possible variant).
In this case, we will extend and change our set of operations regularly,
as we add new input and output filters. But we will only change the possible
data types after careful deliberation. So enum
is the better choice here.
Variants
An array of another data type. For many output formats, it may not be possible to nest arrays.
A boolean value.
A date, with no associated time value.
A decimal integer (can represent currency, etc., without rounding errors).
4-byte float.
8-byte float.
GeoJson(Srid)
Geodata in GeoJSON format, using the specified SRID.
2-byte int.
4-byte integer.
8-byte integer.
JSON data. This includes both Postgres json
and jsonb
types, the
differences between which don't usually matter when converting schemas.
Other(String)
A data type which isn't in this list.
A text type.
A timestamp with no timezone. Ideally, this will would be in UTC, and some systems like BigQuery may automatically assume that.
A timestamp with a timezone.
A UUID.
Trait Implementations
impl Clone for DataType
[src]
impl Debug for DataType
[src]
impl<'de> Deserialize<'de> for DataType
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for DataType
[src]
impl PartialEq<DataType> for DataType
[src]
impl Serialize for DataType
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for DataType
[src]
impl StructuralPartialEq for DataType
[src]
Auto Trait Implementations
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnwindSafe for DataType
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoSql for T
[src]
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
[src]
Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
[src]
&'a Self: AsExpression<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,