pub enum SqlxType {
Text(String),
Blob(Vec<u8>),
Integer(i64),
Real(f64),
}
Expand description
This enum represents the set of types that we currently support in our database Since we support only Sqlite at the moment, those types are close to what is supported by Sqlite: https://www.sqlite.org/datatype3.html
The purpose of this type is to ease the serialization of data types in Ockam into data types in
our database. For example, if we describe how to translate an Identifier
into some Text
then
we can use the Text
as a parameter in a sqlx query.
Note: see the ToSqlxType
trait and its instances for how the conversion is done
Variants§
Text(String)
This type represents text in the database
Blob(Vec<u8>)
This type represents arbitrary bytes in the database
Integer(i64)
This type represents ints, signed or unsigned
Real(f64)
This type represents floats
Trait Implementations§
source§impl Encode<'_, Sqlite> for SqlxType
impl Encode<'_, Sqlite> for SqlxType
The SqlType implements the Encode
source§fn encode_by_ref(
&self,
buf: &mut <Sqlite as HasArguments<'_>>::ArgumentBuffer
) -> IsNull
fn encode_by_ref( &self, buf: &mut <Sqlite as HasArguments<'_>>::ArgumentBuffer ) -> IsNull
fn produces(&self) -> Option<<Sqlite as Database>::TypeInfo>
§fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
self
into buf
in the expected format for the database.