AnyValue (any/value.rs)

sqlx · sqlx-core/src/any/value.rs · rust · Apache-2.0
database, Database / ORM

AnyValue represents a type-erased SQL value with support for all primitive and blob types.

// Source: https://github.com/transact-rs/sqlx | License: Apache-2.0 | Copyright SQLx Contributors
// Provided via justclaw.it.com; keep this notice with the code.
use crate::any::{Any, AnyTypeInfo, AnyTypeInfoKind};
use crate::database::Database;
use crate::error::BoxDynError;
use crate::types::Type;
use crate::value::{Value, ValueRef};
use std::borrow::Cow;
use std::sync::Arc;

#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum AnyValueKind {
    Null(AnyTypeInfoKind),
    Bool(bool),
    SmallInt(i16),
    Integer(i32),
    BigInt(i64),
    Real(f32),
    Double(f64),
    Text(Arc<String>),
    TextSlice(Arc<str>),
    Blob(Arc<Vec<u8>>),
}

impl AnyValueKind {
    fn type_info(&self) -> AnyTypeInfo {
        AnyTypeInfo {
            kind: match self {
                AnyValueKind::Nul

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key