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>)

Tuple Fields

0: Box<Type>

The array’s element 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

Struct(StructType)

The STRUCT data type.

Implementations

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

Panics

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

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

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

Wrap the input message T in a tonic::Request
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more