Struct udf::SqlArg

source ·
pub struct SqlArg<'a, S: UdfState> { /* private fields */ }
Expand description

A single SQL argument, including its attributes

This struct contains the argument itself. It uses a typestate pattern (S) to have slightly different functionality when used during initialization and during processing.

Implementations§

source§

impl<'a, T: UdfState> SqlArg<'a, T>

source

pub fn value(&self) -> SqlResult<'a>

The actual argument type and value

source

pub fn attribute(&'a self) -> &'a str

A string representation of this argument’s identifier

source§

impl<'a> SqlArg<'a, Init>

This includes functions that are only applicable during initialization

source

pub fn is_const(&self) -> bool

Determine whether an argument may be constant

During initialization, a value is const if it is not None. This provides a simple test to see if this is true.

There is no way to differentiate between “not const” and “const but NULL” when we are in the Process step.

source

pub fn maybe_null(&self) -> bool

Whether or not this argument may be NULL

source

pub fn set_type_coercion(&mut self, newtype: SqlType)

Instruct the SQL application to coerce the argument’s type. This does not change the underlying value visible in .value.

source

pub fn get_type_coercion(&self) -> SqlType

Retrieve the current type coercision

Trait Implementations§

source§

impl<'a, S: Debug + UdfState> Debug for SqlArg<'a, S>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, S> !RefUnwindSafe for SqlArg<'a, S>

§

impl<'a, S> !Send for SqlArg<'a, S>

§

impl<'a, S> !Sync for SqlArg<'a, S>

§

impl<'a, S> Unpin for SqlArg<'a, S>where S: Unpin,

§

impl<'a, S> !UnwindSafe for SqlArg<'a, S>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.