Struct MsFunc
pub struct MsFunc;Expand description
Function call helper.
Implementations§
§impl MsFunc
impl MsFunc
pub fn convert_as<V, I>(expr: V, iden: I) -> FunctionCall
pub fn convert_as<V, I>(expr: V, iden: I) -> FunctionCall
Call CONVERT function with a custom type.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(MsFunc::convert_as(123, Alias::new("text")))
.to_owned();
assert_eq!(
query.to_string(MsSqlQueryBuilder),
r#"SELECT CONVERT(text, 123)"#
);pub fn db_name() -> FunctionCall
pub fn db_name() -> FunctionCall
Get current database name.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select().expr(MsFunc::db_name()).to_owned();
assert_eq!(query.to_string(MsSqlQueryBuilder), r#"SELECT DB_NAME()"#);pub fn iif<C, T, F>(cond: C, if_true: T, if_false: F) -> FunctionCall
pub fn iif<C, T, F>(cond: C, if_true: T, if_false: F) -> FunctionCall
If.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.expr(MsFunc::iif(Expr::val(2).gt(1), 1, 0))
.to_owned();
assert_eq!(
query.to_string(MsSqlQueryBuilder),
r#"SELECT IIF(2 > 1, 1, 0)"#
);pub fn getdate() -> FunctionCall
pub fn getdate() -> FunctionCall
The getdate() -> datetime function.
https://learn.microsoft.com/en-us/sql/t-sql/functions/getdate-transact-sql?view=sql-server-2016
pub fn newid() -> FunctionCall
pub fn newid() -> FunctionCall
The newid() -> uniqueidentifier function.
https://learn.microsoft.com/en-us/sql/t-sql/functions/newid-transact-sql?view=sql-server-2016
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MsFunc
impl RefUnwindSafe for MsFunc
impl Send for MsFunc
impl Sync for MsFunc
impl Unpin for MsFunc
impl UnwindSafe for MsFunc
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
Mutably borrows from an owned value. Read more