pub trait ToSpanner {
    fn to_spanner(&self) -> Result<Value, Error>;
    fn spanner_type() -> Type
    where
        Self: Sized
; }
Expand description

A trait for Rust types that can be converted to Cloud Spanner values.

Types

The crate provides the following mapping between Cloud Spanner types and Rust types.

Rust TypeSpanner Type
boolBOOL
u8, i8, u16, i16, u32, i32, i64INT64
f64FLOAT64
&str, StringSTRING
&[u8], BytesBYTES

The following are provided when the corresponding feature is enabled:

FeatureRust TypeSpanner Type
jsonserde_json::ValueJSON
numericbigdecimal::BigDecimalNUMERIC
temporalchrono::DateTime<Utc>TIMESTAMP
temporalchrono::NaiveDateDATE

Nullability

ToSpanner is implemented for Option<T> when T implements ToSpanner. Option<T> represents a nullable Spanner value.

Arrays

ToSpanner is implemented for Vec<T> when T implements ToSpanner. Such values map to Spanner’s Array type. Arrays may contain null values (i.e.: Vec<Option<T>>). Note that Vec<Vec<T>> is not allowed.

Required Methods

Creates a new Cloud Spanner value from this value.

Returns the Cloud Spanner Type that this implementation produces.

Implementations on Foreign Types

Implementors