pub enum PostgresValue<'a> {
Smallint(i16),
Integer(i32),
Bigint(i64),
Real(f32),
DoublePrecision(f64),
Text(Cow<'a, str>),
Bytea(Cow<'a, [u8]>),
Boolean(bool),
Enum(Box<dyn PostgresEnum>),
Array(Vec<Self>),
Null,
}Expand description
Represents a PostgreSQL value.
This enum provides type-safe value handling for PostgreSQL operations.
§Examples
use drizzle_postgres::values::PostgresValue;
// Integer conversion
let int_val: PostgresValue<'_> = 42i32.into();
assert!(matches!(int_val, PostgresValue::Integer(42)));
// String conversion
let str_val: PostgresValue<'_> = "hello".into();
assert!(matches!(str_val, PostgresValue::Text(_)));
// Boolean conversion
let bool_val: PostgresValue<'_> = true.into();
assert!(matches!(bool_val, PostgresValue::Boolean(true)));Variants§
Smallint(i16)
SMALLINT values (16-bit signed integer)
Integer(i32)
INTEGER values (32-bit signed integer)
Bigint(i64)
BIGINT values (64-bit signed integer)
Real(f32)
REAL values (32-bit floating point)
DoublePrecision(f64)
DOUBLE PRECISION values (64-bit floating point)
Text(Cow<'a, str>)
TEXT, VARCHAR, CHAR values
Bytea(Cow<'a, [u8]>)
BYTEA values (binary data)
Boolean(bool)
BOOLEAN values
Enum(Box<dyn PostgresEnum>)
Native PostgreSQL ENUM values
Array(Vec<Self>)
Array of any PostgreSQL type
Null
NULL value
Implementations§
Source§impl PostgresValue<'_>
impl PostgresValue<'_>
Sourcepub fn as_enum(&self) -> Option<&dyn PostgresEnum>
pub fn as_enum(&self) -> Option<&dyn PostgresEnum>
Returns the enum value if this is a PostgreSQL enum.
Sourcepub fn into_owned(self) -> OwnedPostgresValue
pub fn into_owned(self) -> OwnedPostgresValue
Converts this value into an owned representation.
Sourcepub fn convert<T: FromPostgresValue>(self) -> Result<T, DrizzleError>
pub fn convert<T: FromPostgresValue>(self) -> Result<T, DrizzleError>
Convert this PostgreSQL value to a Rust type using the FromPostgresValue trait.
§Errors
Returns DrizzleError::ConversionError when the stored variant’s
native type does not match the target type T.
Sourcepub fn convert_ref<T: FromPostgresValue>(&self) -> Result<T, DrizzleError>
pub fn convert_ref<T: FromPostgresValue>(&self) -> Result<T, DrizzleError>
Convert a reference to this PostgreSQL value to a Rust type.
§Errors
Returns DrizzleError::ConversionError when the stored variant’s
native type does not match the target type T.
Trait Implementations§
Source§impl<'a> Clone for PostgresValue<'a>
impl<'a> Clone for PostgresValue<'a>
Source§fn clone(&self) -> PostgresValue<'a>
fn clone(&self) -> PostgresValue<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for PostgresValue<'a>
impl<'a> Debug for PostgresValue<'a>
Source§impl<'a> Default for PostgresValue<'a>
impl<'a> Default for PostgresValue<'a>
Source§fn default() -> PostgresValue<'a>
fn default() -> PostgresValue<'a>
Source§impl Display for PostgresValue<'_>
impl Display for PostgresValue<'_>
Source§impl<'a, S, State, T, M, R, G> Expr<'a, PostgresValue<'a>> for SelectBuilder<'a, S, State, T, M, R, G>
impl<'a, S, State, T, M, R, G> Expr<'a, PostgresValue<'a>> for SelectBuilder<'a, S, State, T, M, R, G>
Source§type SQLType = <M as SubqueryType<'a, PostgresValue<'a>>>::SQLType
type SQLType = <M as SubqueryType<'a, PostgresValue<'a>>>::SQLType
Source§fn to_expr_sql(&self) -> SQL<'a, V>
fn to_expr_sql(&self) -> SQL<'a, V>
Source§fn into_expr_sql(self) -> SQL<'a, V>where
Self: Sized,
fn into_expr_sql(self) -> SQL<'a, V>where
Self: Sized,
Source§impl<'a> From<&'a OwnedPostgresValue> for PostgresValue<'a>
impl<'a> From<&'a OwnedPostgresValue> for PostgresValue<'a>
Source§fn from(value: &'a OwnedPostgresValue) -> Self
fn from(value: &'a OwnedPostgresValue) -> Self
Source§impl<'a> From<&'a PostgresValue<'a>> for Cow<'a, PostgresValue<'a>>
impl<'a> From<&'a PostgresValue<'a>> for Cow<'a, PostgresValue<'a>>
Source§fn from(value: &'a PostgresValue<'a>) -> Self
fn from(value: &'a PostgresValue<'a>) -> Self
Source§impl<'a> From<&'a String> for PostgresValue<'a>
impl<'a> From<&'a String> for PostgresValue<'a>
Source§impl<'a> From<&'a [PostgresValue<'a>]> for PostgresValue<'a>
impl<'a> From<&'a [PostgresValue<'a>]> for PostgresValue<'a>
Source§impl<'a> From<&'a [u8]> for PostgresValue<'a>
impl<'a> From<&'a [u8]> for PostgresValue<'a>
Source§impl<'a> From<&'a bool> for PostgresValue<'a>
impl<'a> From<&'a bool> for PostgresValue<'a>
Source§impl<'a> From<&'a f32> for PostgresValue<'a>
impl<'a> From<&'a f32> for PostgresValue<'a>
Source§impl<'a> From<&'a f64> for PostgresValue<'a>
impl<'a> From<&'a f64> for PostgresValue<'a>
Source§impl<'a> From<&'a i8> for PostgresValue<'a>
impl<'a> From<&'a i8> for PostgresValue<'a>
Source§impl<'a> From<&'a i16> for PostgresValue<'a>
impl<'a> From<&'a i16> for PostgresValue<'a>
Source§impl<'a> From<&'a i32> for PostgresValue<'a>
impl<'a> From<&'a i32> for PostgresValue<'a>
Source§impl<'a> From<&'a i64> for PostgresValue<'a>
impl<'a> From<&'a i64> for PostgresValue<'a>
Source§impl<'a> From<&'a isize> for PostgresValue<'a>
impl<'a> From<&'a isize> for PostgresValue<'a>
Source§impl<'a> From<&'a str> for PostgresValue<'a>
impl<'a> From<&'a str> for PostgresValue<'a>
Source§impl<'a> From<&'a u8> for PostgresValue<'a>
impl<'a> From<&'a u8> for PostgresValue<'a>
Source§impl<'a> From<&'a u16> for PostgresValue<'a>
impl<'a> From<&'a u16> for PostgresValue<'a>
Source§impl<'a> From<&'a u32> for PostgresValue<'a>
impl<'a> From<&'a u32> for PostgresValue<'a>
Source§impl<'a> From<&'a u64> for PostgresValue<'a>
impl<'a> From<&'a u64> for PostgresValue<'a>
Source§impl<'a> From<&'a usize> for PostgresValue<'a>
impl<'a> From<&'a usize> for PostgresValue<'a>
Source§impl<'a> From<&PostgresValue<'a>> for OwnedPostgresValue
impl<'a> From<&PostgresValue<'a>> for OwnedPostgresValue
Source§fn from(value: &PostgresValue<'a>) -> Self
fn from(value: &PostgresValue<'a>) -> Self
Source§impl From<OwnedPostgresValue> for PostgresValue<'_>
impl From<OwnedPostgresValue> for PostgresValue<'_>
Source§fn from(value: OwnedPostgresValue) -> Self
fn from(value: OwnedPostgresValue) -> Self
Source§impl<'a> From<PostgresValue<'a>> for OwnedPostgresValue
impl<'a> From<PostgresValue<'a>> for OwnedPostgresValue
Source§fn from(value: PostgresValue<'a>) -> Self
fn from(value: PostgresValue<'a>) -> Self
Source§impl<'a> From<PostgresValue<'a>> for SQL<'a, PostgresValue<'a>>
impl<'a> From<PostgresValue<'a>> for SQL<'a, PostgresValue<'a>>
Source§fn from(value: PostgresValue<'a>) -> Self
fn from(value: PostgresValue<'a>) -> Self
Source§impl<'a> From<PostgresValue<'a>> for Cow<'a, PostgresValue<'a>>
impl<'a> From<PostgresValue<'a>> for Cow<'a, PostgresValue<'a>>
Source§fn from(value: PostgresValue<'a>) -> Self
fn from(value: PostgresValue<'a>) -> Self
Source§impl From<String> for PostgresValue<'_>
impl From<String> for PostgresValue<'_>
Source§impl<'a, T> From<T> for PostgresValue<'a>where
T: DrizzlePostgresColumn,
impl<'a, T> From<T> for PostgresValue<'a>where
T: DrizzlePostgresColumn,
Source§impl From<Vec<PostgresValue<'_>>> for PostgresValue<'_>
impl From<Vec<PostgresValue<'_>>> for PostgresValue<'_>
Source§impl From<bool> for PostgresValue<'_>
impl From<bool> for PostgresValue<'_>
Source§impl From<f32> for PostgresValue<'_>
impl From<f32> for PostgresValue<'_>
Source§impl From<f64> for PostgresValue<'_>
impl From<f64> for PostgresValue<'_>
Source§impl From<i8> for PostgresValue<'_>
impl From<i8> for PostgresValue<'_>
Source§impl From<i16> for PostgresValue<'_>
impl From<i16> for PostgresValue<'_>
Source§impl From<i32> for PostgresValue<'_>
impl From<i32> for PostgresValue<'_>
Source§impl From<i64> for PostgresValue<'_>
impl From<i64> for PostgresValue<'_>
Source§impl From<isize> for PostgresValue<'_>
impl From<isize> for PostgresValue<'_>
Source§impl From<u8> for PostgresValue<'_>
impl From<u8> for PostgresValue<'_>
Source§impl From<u16> for PostgresValue<'_>
impl From<u16> for PostgresValue<'_>
Source§impl From<u32> for PostgresValue<'_>
impl From<u32> for PostgresValue<'_>
Source§impl From<u64> for PostgresValue<'_>
impl From<u64> for PostgresValue<'_>
Source§impl From<usize> for PostgresValue<'_>
impl From<usize> for PostgresValue<'_>
Source§impl<'a> PartialEq for PostgresValue<'a>
impl<'a> PartialEq for PostgresValue<'a>
Source§impl SQLParam for PostgresValue<'_>
impl SQLParam for PostgresValue<'_>
Source§const DIALECT: Dialect = drizzle_core::dialect::Dialect::PostgreSQL
const DIALECT: Dialect = drizzle_core::dialect::Dialect::PostgreSQL
Source§type DialectMarker = PostgresDialect
type DialectMarker = PostgresDialect
impl<'a> StructuralPartialEq for PostgresValue<'a>
Source§impl<'a, Table, Query> ToSQL<'a, PostgresValue<'a>> for CTEView<'a, Table, Query>where
Query: ToSQL<'a, PostgresValue<'a>>,
impl<'a, Table, Query> ToSQL<'a, PostgresValue<'a>> for CTEView<'a, Table, Query>where
Query: ToSQL<'a, PostgresValue<'a>>,
Source§impl<'a, State> ToSQL<'a, PostgresValue<'a>> for RefreshMaterializedView<'a, State>
impl<'a, State> ToSQL<'a, PostgresValue<'a>> for RefreshMaterializedView<'a, State>
Source§impl<'a, Schema, State, Table, Marker, Row, Grouped> ToSQL<'a, PostgresValue<'a>> for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
impl<'a, Schema, State, Table, Marker, Row, Grouped> ToSQL<'a, PostgresValue<'a>> for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
Source§impl<'a, T> ToSQL<'a, PostgresValue<'a>> for PgArray<T>
impl<'a, T> ToSQL<'a, PostgresValue<'a>> for PgArray<T>
Source§impl<'a> TryFrom<&'a PostgresValue<'a>> for &'a str
impl<'a> TryFrom<&'a PostgresValue<'a>> for &'a str
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<&'a PostgresValue<'a>> for &'a [u8]
impl<'a> TryFrom<&'a PostgresValue<'a>> for &'a [u8]
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<&'a PostgresValue<'a>> for &'a [PostgresValue<'a>]
impl<'a> TryFrom<&'a PostgresValue<'a>> for &'a [PostgresValue<'a>]
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for i16
impl<'a> TryFrom<PostgresValue<'a>> for i16
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for i32
impl<'a> TryFrom<PostgresValue<'a>> for i32
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for i64
impl<'a> TryFrom<PostgresValue<'a>> for i64
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for f32
impl<'a> TryFrom<PostgresValue<'a>> for f32
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for f64
impl<'a> TryFrom<PostgresValue<'a>> for f64
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for bool
impl<'a> TryFrom<PostgresValue<'a>> for bool
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for String
impl<'a> TryFrom<PostgresValue<'a>> for String
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Box<String>
impl<'a> TryFrom<PostgresValue<'a>> for Box<String>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Rc<String>
impl<'a> TryFrom<PostgresValue<'a>> for Rc<String>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Arc<String>
impl<'a> TryFrom<PostgresValue<'a>> for Arc<String>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Box<str>
impl<'a> TryFrom<PostgresValue<'a>> for Box<str>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Rc<str>
impl<'a> TryFrom<PostgresValue<'a>> for Rc<str>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Arc<str>
impl<'a> TryFrom<PostgresValue<'a>> for Arc<str>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Vec<u8>
impl<'a> TryFrom<PostgresValue<'a>> for Vec<u8>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Box<Vec<u8>>
impl<'a> TryFrom<PostgresValue<'a>> for Box<Vec<u8>>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Rc<Vec<u8>>
impl<'a> TryFrom<PostgresValue<'a>> for Rc<Vec<u8>>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Arc<Vec<u8>>
impl<'a> TryFrom<PostgresValue<'a>> for Arc<Vec<u8>>
Source§type Error = DrizzleError
type Error = DrizzleError
Source§impl<'a> TryFrom<PostgresValue<'a>> for Vec<PostgresValue<'a>>
impl<'a> TryFrom<PostgresValue<'a>> for Vec<PostgresValue<'a>>
Source§type Error = DrizzleError
type Error = DrizzleError
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for PostgresValue<'a>
impl<'a> !UnwindSafe for PostgresValue<'a>
impl<'a> Freeze for PostgresValue<'a>
impl<'a> Send for PostgresValue<'a>
impl<'a> Sync for PostgresValue<'a>
impl<'a> Unpin for PostgresValue<'a>
impl<'a> UnsafeUnpin for PostgresValue<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<Mk> MarkerAggValidFor<()> for Mk
impl<Scope> ScopeSatisfies<Nil, ()> for Scope
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more