[−][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.
A text type.
Struct(Vec<StructField>)
A structure with a known set of named fields.
Field names must be unique within a struct, and non-empty.
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]
pub 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]
pub 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
[src]
impl Send for DataType
[src]
impl Sync for DataType
[src]
impl Unpin for DataType
[src]
impl UnwindSafe for DataType
[src]
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> 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,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,