Struct udf::UdfCfg

source ·
pub struct UdfCfg<S: UdfState>(/* private fields */);
Expand description

A collection of SQL arguments

This is rusty wrapper around SQL’s UDF_INIT struct, providing methods to easily and safely work with arguments.

Implementations§

source§

impl<S: UdfState> UdfCfg<S>

source

pub fn get_maybe_null(&self) -> bool

Retrieve the setting for whether this UDF may return null

This defaults to true if any argument is nullable, false otherwise

source

pub fn get_decimals(&self) -> u32

Retrieve the setting for number of decimal places

This defaults to the longest number of digits of any argument, or 31 if there is no fixed number

source

pub fn set_decimals(&self, v: u32)

Set the number of decimals this function returns

This can be changed at any point in the UDF (init or process)

source

pub fn get_max_len(&self) -> u64

Retrieve the current maximum length setting for this in-progress UDF

source

pub fn get_is_const(&self) -> bool

Get the current const_item value

source§

impl UdfCfg<Init>

Implementations of actions on a UdfCfg that are only possible during initialization

source

pub fn set_maybe_null(&self, v: bool)

Set whether or not this function may return null

source

pub fn set_max_len(&self, v: u64)

Set the maximum possible length of this UDF’s result

This is mostly relevant for String and Decimal return types. See MaxLenOptions for possible defaults, including BLOB sizes.

source

pub fn set_is_const(&self, v: bool)

Set a new const_item value

Set this to true if your function always returns the same values with the same arguments

Trait Implementations§

source§

impl<T: UdfState> Debug for UdfCfg<T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for UdfCfg<S>

§

impl<S> !Send for UdfCfg<S>

§

impl<S> !Sync for UdfCfg<S>

§

impl<S> Unpin for UdfCfg<S>where S: Unpin,

§

impl<S> UnwindSafe for UdfCfg<S>where S: UnwindSafe,

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.