From 6b5f37dfb10bf61b95de217dd91355416a4eeb03 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Fri, 26 Feb 2021 00:19:42 -0800 Subject: [PATCH] feat(core): add sqlx::RawValue --- sqlx-core/src/raw_value.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sqlx-core/src/raw_value.rs diff --git a/sqlx-core/src/raw_value.rs b/sqlx-core/src/raw_value.rs new file mode 100644 index 00000000..09c7b114 --- /dev/null +++ b/sqlx-core/src/raw_value.rs @@ -0,0 +1,16 @@ +use std::any; + +use crate::database::HasRawValue; +use crate::{decode, Database, Decode, TypeDecode, TypeInfo}; + +// NOTE: Add decode() and decode_unchecked() to RawValue as provided methods +// once Rust has lazy normalization and/or GATs. +pub trait RawValue<'r>: Sized { + type Database: Database; + + /// Returns `true` if this value is the SQL `NULL`. + fn is_null(&self) -> bool; + + /// Returns the type information for this value. + fn type_info(&self) -> &'r ::TypeInfo; +}