Skip to main content

MySQLValue

Enum MySQLValue 

Source
pub enum MySQLValue<'a> {
    Null,
    Bytes(Cow<'a, [u8]>),
    Int(i64),
    UInt(u64),
    Float(f32),
    Double(f64),
    Date {
        year: u16,
        month: u8,
        day: u8,
        hour: u8,
        minute: u8,
        second: u8,
        microseconds: u32,
    },
    Time {
        negative: bool,
        days: u32,
        hours: u8,
        minutes: u8,
        seconds: u8,
        microseconds: u32,
    },
}
Expand description

A value in one of MySQL’s wire categories, possibly borrowing its bytes.

Used for bound parameters and for cells read from a row. The variants mirror the values of the mysql and mysql_async clients, so this crate does not depend on either. See OwnedMySQLValue for an owned form.

Variants§

§

Null

SQL NULL.

§

Bytes(Cow<'a, [u8]>)

Text, binary, decimal, JSON, enum, and set payloads.

§

Int(i64)

Signed integer payload.

§

UInt(u64)

Unsigned integer payload.

§

Float(f32)

Single-precision floating-point payload.

§

Double(f64)

Double-precision floating-point payload.

§

Date

Date, datetime, or timestamp payload.

Fields

§year: u16

Four-digit year.

§month: u8

Month in the range 1 through 12.

§day: u8

Day of the month.

§hour: u8

Hour in the range 0 through 23.

§minute: u8

Minute in the range 0 through 59.

§second: u8

Second in the range 0 through 59.

§microseconds: u32

Fractional seconds in microseconds.

§

Time

Time or duration payload.

Fields

§negative: bool

Whether the duration is negative.

§days: u32

Whole days in the duration.

§hours: u8

Remaining hours after whole days.

§minutes: u8

Remaining minutes after whole hours.

§seconds: u8

Remaining seconds after whole minutes.

§microseconds: u32

Fractional seconds in microseconds.

Implementations§

Source§

impl MySQLValue<'_>

Source

pub const fn is_null(&self) -> bool

Returns true if this value is SQL NULL.

Source

pub fn as_bytes(&self) -> Option<&[u8]>

Returns the bytes of a Bytes value (text, binary, decimal, JSON, enum or set), or None for other variants.

Source

pub fn as_ref(&self) -> MySQLValue<'_>

Returns a borrowed view of this value.

Source

pub fn into_owned(self) -> OwnedMySQLValue

Converts this value into an owned representation.

Trait Implementations§

Source§

impl<'a> Clone for MySQLValue<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for MySQLValue<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for MySQLValue<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, S, State, T, M, R, G> Expr<'a, MySQLValue<'a>> for SelectBuilder<'a, S, State, T, M, R, G>

Source§

type SQLType = <M as SubqueryType<'a, MySQLValue<'a>>>::SQLType

The SQL data type this expression evaluates to.
Source§

type Nullable = Null

Whether this expression can be NULL.
Source§

type Aggregate = Scalar

Whether this is an aggregate (COUNT, SUM) or scalar expression.
Source§

fn to_expr_sql(&self) -> SQL<'a, V>

Renders this value as a scalar expression, borrowing it. Read more
Source§

fn into_expr_sql(self) -> SQL<'a, V>
where Self: Sized,

Renders this value as a scalar expression, consuming it.
Source§

fn to_condition_sql(&self) -> Option<SQL<'a, V>>

Renders this value as one element of a ConditionList. Read more
Source§

fn into_condition_sql(self) -> Option<SQL<'a, V>>
where Self: Sized,

Consuming counterpart of Expr::to_condition_sql.
Source§

impl<'a> From<&'a Arc<String>> for MySQLValue<'a>

Source§

fn from(value: &'a Arc<String>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Arc<Vec<u8>>> for MySQLValue<'a>

Source§

fn from(value: &'a Arc<Vec<u8>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Arc<str>> for MySQLValue<'a>

Source§

fn from(value: &'a Arc<str>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Box<String>> for MySQLValue<'a>

Source§

fn from(value: &'a Box<String>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Box<Vec<u8>>> for MySQLValue<'a>

Source§

fn from(value: &'a Box<Vec<u8>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Box<str>> for MySQLValue<'a>

Source§

fn from(value: &'a Box<str>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a MySQLValue<'a>> for Cow<'a, MySQLValue<'a>>

Source§

fn from(value: &'a MySQLValue<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a OwnedMySQLValue> for MySQLValue<'a>

Source§

fn from(value: &'a OwnedMySQLValue) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Rc<String>> for MySQLValue<'a>

Source§

fn from(value: &'a Rc<String>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Rc<Vec<u8>>> for MySQLValue<'a>

Source§

fn from(value: &'a Rc<Vec<u8>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Rc<str>> for MySQLValue<'a>

Source§

fn from(value: &'a Rc<str>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a String> for MySQLValue<'a>

Source§

fn from(value: &'a String) -> Self

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a [u8; N]> for MySQLValue<'a>

Source§

fn from(value: &'a [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a [u8]> for MySQLValue<'a>

Source§

fn from(value: &'a [u8]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for MySQLValue<'a>

Source§

fn from(value: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<&[char; N]> for MySQLValue<'_>

Source§

fn from(value: &[char; N]) -> Self

Converts to this type from the input type.
Source§

impl From<&bool> for MySQLValue<'_>

Source§

fn from(value: &bool) -> Self

Converts to this type from the input type.
Source§

impl From<&f32> for MySQLValue<'_>

Source§

fn from(value: &f32) -> Self

Converts to this type from the input type.
Source§

impl From<&f64> for MySQLValue<'_>

Source§

fn from(value: &f64) -> Self

Converts to this type from the input type.
Source§

impl From<&i8> for MySQLValue<'_>

Source§

fn from(value: &i8) -> Self

Converts to this type from the input type.
Source§

impl From<&i16> for MySQLValue<'_>

Source§

fn from(value: &i16) -> Self

Converts to this type from the input type.
Source§

impl From<&i32> for MySQLValue<'_>

Source§

fn from(value: &i32) -> Self

Converts to this type from the input type.
Source§

impl From<&i64> for MySQLValue<'_>

Source§

fn from(value: &i64) -> Self

Converts to this type from the input type.
Source§

impl From<&isize> for MySQLValue<'_>

Source§

fn from(value: &isize) -> Self

Converts to this type from the input type.
Source§

impl From<&u8> for MySQLValue<'_>

Source§

fn from(value: &u8) -> Self

Converts to this type from the input type.
Source§

impl From<&u16> for MySQLValue<'_>

Source§

fn from(value: &u16) -> Self

Converts to this type from the input type.
Source§

impl From<&u32> for MySQLValue<'_>

Source§

fn from(value: &u32) -> Self

Converts to this type from the input type.
Source§

impl From<&u64> for MySQLValue<'_>

Source§

fn from(value: &u64) -> Self

Converts to this type from the input type.
Source§

impl From<&usize> for MySQLValue<'_>

Source§

fn from(value: &usize) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<String>> for MySQLValue<'_>

Source§

fn from(value: Arc<String>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<Vec<u8>>> for MySQLValue<'_>

Source§

fn from(value: Arc<Vec<u8>>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<str>> for MySQLValue<'_>

Source§

fn from(value: Arc<str>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<String>> for MySQLValue<'_>

Source§

fn from(value: Box<String>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<Vec<u8>>> for MySQLValue<'_>

Source§

fn from(value: Box<Vec<u8>>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<str>> for MySQLValue<'_>

Source§

fn from(value: Box<str>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, [u8]>> for MySQLValue<'a>

Source§

fn from(value: Cow<'a, [u8]>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, str>> for MySQLValue<'a>

Source§

fn from(value: Cow<'a, str>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<MySQLValue<'a>> for Cow<'a, MySQLValue<'a>>

Source§

fn from(value: MySQLValue<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<MySQLValue<'a>> for OwnedMySQLValue

Source§

fn from(value: MySQLValue<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<MySQLValue<'a>> for SQL<'a, MySQLValue<'a>>

Source§

fn from(value: MySQLValue<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<Option<T>> for MySQLValue<'a>
where MySQLValue<'a>: From<T>,

Source§

fn from(value: Option<T>) -> Self

Converts to this type from the input type.
Source§

impl From<OwnedMySQLValue> for MySQLValue<'_>

Source§

fn from(value: OwnedMySQLValue) -> Self

Converts to this type from the input type.
Source§

impl From<Rc<String>> for MySQLValue<'_>

Source§

fn from(value: Rc<String>) -> Self

Converts to this type from the input type.
Source§

impl From<Rc<Vec<u8>>> for MySQLValue<'_>

Source§

fn from(value: Rc<Vec<u8>>) -> Self

Converts to this type from the input type.
Source§

impl From<Rc<str>> for MySQLValue<'_>

Source§

fn from(value: Rc<str>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for MySQLValue<'_>

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<T> for MySQLValue<'a>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for MySQLValue<'_>

Source§

fn from(value: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[char; N]> for MySQLValue<'_>

Source§

fn from(value: [char; N]) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[u8; N]> for MySQLValue<'_>

Source§

fn from(value: [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for MySQLValue<'_>

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<char> for MySQLValue<'_>

Source§

fn from(value: char) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for MySQLValue<'_>

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for MySQLValue<'_>

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for MySQLValue<'_>

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for MySQLValue<'_>

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for MySQLValue<'_>

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for MySQLValue<'_>

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for MySQLValue<'_>

Source§

fn from(value: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for MySQLValue<'_>

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for MySQLValue<'_>

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for MySQLValue<'_>

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for MySQLValue<'_>

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for MySQLValue<'_>

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl<'a> PartialEq for MySQLValue<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl SQLParam for MySQLValue<'_>

Source§

const DIALECT: Dialect = Dialect::MySQL

The dialect, at runtime.
Source§

type DialectMarker = MySQLDialect

The dialect, as a type (SQLiteDialect, PostgresDialect or MySQLDialect). Read more
Source§

fn pagination_param(value: usize) -> Option<Self>

Converts a LIMIT/OFFSET value into a parameter, or returns None to write it as a literal (the default). Read more
Source§

fn write_literal(&self, buf: &mut String) -> bool

Appends this value to buf as a SQL literal of this dialect. Read more
Source§

impl<'a> StructuralPartialEq for MySQLValue<'a>

Source§

impl<'a, Schema, State, Table, Marker, Row, Grouped> ToSQL<'a, MySQLValue<'a>> for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
where State: ExecutableState,

Source§

fn to_sql(&self) -> SQL<'a, MySQLValue<'a>>

Renders self as a SQL fragment.
Source§

fn into_sql(self) -> SQL<'a, MySQLValue<'a>>

Renders self as a SQL fragment, consuming it. Read more
Source§

impl<'a, T> ToSQL<'a, MySQLValue<'a>> for OrderExpr<T>
where T: ToSQL<'a, MySQLValue<'a>>,

Source§

fn to_sql(&self) -> SQL<'a, MySQLValue<'a>>

Renders self as a SQL fragment.
Source§

fn into_sql(self) -> SQL<'a, V>
where Self: Sized,

Renders self as a SQL fragment, consuming it. Read more
Source§

impl<'a> ToSQL<'a, MySQLValue<'a>> for OutputAlias

Source§

fn to_sql(&self) -> SQL<'a, MySQLValue<'a>>

Renders self as a SQL fragment.
Source§

fn into_sql(self) -> SQL<'a, V>
where Self: Sized,

Renders self as a SQL fragment, consuming it. Read more
Source§

impl<'a> ToSQL<'a, MySQLValue<'a>> for MySQLValue<'a>

Source§

fn to_sql(&self) -> SQL<'a, Self>

Renders self as a SQL fragment.
Source§

fn into_sql(self) -> SQL<'a, V>
where Self: Sized,

Renders self as a SQL fragment, consuming it. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MySQLValue<'a>

§

impl<'a> RefUnwindSafe for MySQLValue<'a>

§

impl<'a> Send for MySQLValue<'a>

§

impl<'a> Sync for MySQLValue<'a>

§

impl<'a> Unpin for MySQLValue<'a>

§

impl<'a> UnsafeUnpin for MySQLValue<'a>

§

impl<'a> UnwindSafe for MySQLValue<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Joined, From> JoinKey<From, JoinReverse> for Joined
where From: Joinable<Joined> + ?Sized,

Source§

fn pairs() -> &'static [(&'static str, &'static str)]

(joined_column, from_column) pairs the ON condition matches, in key order, read through Self::pair.
Source§

fn pair(pair: &(&'static str, &'static str)) -> (&'static str, &'static str)

The (joined_column, from_column) names of pair.
Source§

impl<List> ListIncludes<Nil, ()> for List

Source§

impl<Mk> MarkerAggValidFor<()> for Mk

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeEq<T> for T