#[non_exhaustive]pub enum TypeCode {
Show 18 variants
Unspecified,
Bool,
Int64,
Float64,
Float32,
Timestamp,
Date,
String,
Bytes,
Array,
Struct,
Numeric,
Json,
Proto,
Enum,
Interval,
Uuid,
UnknownValue(UnknownValue),
}Expand description
TypeCode is used as part of Type to
indicate the type of a Cloud Spanner value.
Each legal value of a type can be encoded to or decoded from a JSON
value, using the encodings described below. All Cloud Spanner values can
be null, regardless of type; nulls are always encoded as a JSON
null.
§Working with unknown values
This enum is defined as #[non_exhaustive] because Google Cloud may add
additional enum variants at any time. Adding new variants is not considered
a breaking change. Applications should write their code in anticipation of:
- New values appearing in future releases of the client library, and
- New values received dynamically, without application changes.
Please consult the Working with enums section in the user guide for some guidelines.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unspecified
Not specified.
Bool
Encoded as JSON true or false.
Int64
Encoded as string, in decimal format.
Float64
Encoded as number, or the strings "NaN", "Infinity", or
"-Infinity".
Float32
Encoded as number, or the strings "NaN", "Infinity", or
"-Infinity".
Timestamp
Encoded as string in RFC 3339 timestamp format. The time zone
must be present, and must be "Z".
If the schema has the column option
allow_commit_timestamp=true, the placeholder string
"spanner.commit_timestamp()" can be used to instruct the system
to insert the commit timestamp associated with the transaction
commit.
Date
Encoded as string in RFC 3339 date format.
String
Encoded as string.
Bytes
Encoded as a base64-encoded string, as described in RFC 4648,
section 4.
Array
Encoded as list, where the list elements are represented
according to
array_element_type.
Struct
Encoded as list, where list element i is represented according
to struct_type.fields[i].
Numeric
Encoded as string, in decimal format or scientific notation format.
Decimal format:
[+-]Digits[.[Digits]] or
[+-][Digits].Digits
Scientific notation:
[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits] or
[+-][Digits].Digits[ExponentIndicator[+-]Digits]
(ExponentIndicator is "e" or "E")
Json
Encoded as a JSON-formatted string as described in RFC 7159. The
following rules are applied when parsing JSON input:
- Whitespace characters are not preserved.
- If a JSON object has duplicate keys, only the first key is preserved.
- Members of a JSON object are not guaranteed to have their order preserved.
- JSON array elements will have their order preserved.
Proto
Encoded as a base64-encoded string, as described in RFC 4648,
section 4.
Enum
Encoded as string, in decimal format.
Interval
Encoded as string, in ISO8601 duration format -
P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S
where n is an integer.
For example, P1Y2M3DT4H5M6.5S represents time duration of 1 year, 2
months, 3 days, 4 hours, 5 minutes, and 6.5 seconds.
Uuid
Encoded as string, in lower-case hexa-decimal format, as described
in RFC 9562, section 4.
UnknownValue(UnknownValue)
If set, the enum was initialized with an unknown value.
Applications can examine the value using TypeCode::value or TypeCode::name.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TypeCode
impl<'de> Deserialize<'de> for TypeCode
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 StructuralPartialEq for TypeCode
Auto Trait Implementations§
impl Freeze for TypeCode
impl RefUnwindSafe for TypeCode
impl Send for TypeCode
impl Sync for TypeCode
impl Unpin for TypeCode
impl UnsafeUnpin for TypeCode
impl UnwindSafe for TypeCode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request