Enum Type

Source
pub enum Type {
    Bool,
    Int64,
    Float64,
    String,
    Bytes,
    Json,
    Numeric,
    Timestamp,
    Date,
    Array(Box<Type>),
    Struct(StructType),
}
Expand description

An enumeration of all Cloud Spanner data types.

Refer to the Cloud Spanner documentation for detailed information about individual data types.

Variants§

§

Bool

The BOOL data type.

  • Storage size: 1 byte
§

Int64

The INT64 data type.

  • Storage size: 8 bytes
  • Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
§

Float64

The FLOAT64 data type.

Supports the special NaN, +inf and -inf values.

  • Storage size: 8 bytes
§

String

The STRING data type.

Must be valid UTF-8.

  • Storage: the number of bytes in its UTF-8 encoding
§

Bytes

The BYTES data type.

  • Storage: the number of bytes
§

Json

The JSON data type.

Note that the JSON document will be canonicalized before storing. Refer to the Cloud Spanner for details.

  • Storage: The number of bytes in UTF-8 encoding of the JSON-formatted string equivalent after canonicalization.
§

Numeric

The NUMERIC data type.

  • Storage: varies between 6 and 22 bytes, except for the value 0 which uses 1 byte.
§

Timestamp

The TIMESTAMP data type.

Refer to the Cloud Spanner documentation for details on timezones and format when used in SQL statements.

  • Storage: 12 bytes
  • Range: 0001-01-01 00:00:00 to 9999-12-31 23:59:59.999999999 UTC.
§

Date

The DATE data type.

  • Storage: 4 bytes
  • Range: 0001-01-01 to 9999-12-31.
  • Canonical format: YYYY-[M]M-[D]D
§

Array(Box<Type>)

The ARRAY data type. Can contain elements of any other type except Array (i.e.: arrays of arrays are not allowed). Can contain NULL elements. A NULL value of type array and an empty array are different values.

  • Storage: the sum of the size of its elements

Tuple Fields

§0: Box<Type>

The array’s element type.

§

Struct(StructType)

The STRUCT data type.

Implementations§

Source§

impl Type

Source

pub fn array(inner: Type) -> Self

Creates a new Type::Array with elements of the specified type.

§Panics

If the provided type is itself an Type::Array.

Source

pub fn strct(fields: Vec<(&str, Type)>) -> Self

Creates a new Type::Struct with the provided field names and types.

Trait Implementations§

Source§

impl Clone for Type

Source§

fn clone(&self) -> Type

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Type

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&Type> for Type

Source§

fn from(value: &Type) -> Self

Converts to this type from the input type.
Source§

impl From<Type> for Type

Source§

fn from(value: Type) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Type

Source§

fn eq(&self, other: &Type) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&Type> for Type

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &Type) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Type> for Type

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: Type) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T