[−][src]Struct rbatis::wrapper::Wrapper
you can serialize to JSON, and Clone, Debug use json rpc send this Wrapper to server
for Example: let w = Wrapper::new(&DriverType::Mysql) .eq("id", 1) .and() .ne("id", 1) .and() .in_array("id", &[1, 2, 3]) .and() .not_in("id", &[1, 2, 3]) .and() .like("name", 1) .or() .not_like("name", "asdf") .and() .between("create_time", "2020-01-01 00:00:00", "2020-12-12 00:00:00") .group_by(&["id"]) .order_by(true, &["id", "name"]) .check().unwrap();
Fields
driver_type: DriverType
sql: String
args: Vec<Value>
error: Option<Error>
Implementations
impl Wrapper
[src]
pub fn new(driver_type: &DriverType) -> Self
[src]
pub fn from(driver_type: &DriverType, sql: &str, args: &Vec<Value>) -> Self
[src]
pub fn check(&mut self) -> Result<Wrapper, Error>
[src]
pub fn link_right_wrapper(&mut self, arg: &Wrapper) -> &mut Self
[src]
link left Wrapper to this Wrapper for Example: let w = Wrapper::new(&DriverType::Postgres).eq("a", "1").check().unwrap(); let w2 = Wrapper::new(&DriverType::Postgres).eq("b", "2") .and() .link_right_wrapper(&w) .check().unwrap(); println!("sql:{:?}", w2.sql.as_str()); // sql:"a = $1 a = $2 " println!("arg:{:?}", w2.args.clone()); // arg:[String("1"), String("2")]
pub fn link_right(
&mut self,
driver_type: &DriverType,
sql: &str,
args: &Vec<Value>
) -> &mut Self
[src]
&mut self,
driver_type: &DriverType,
sql: &str,
args: &Vec<Value>
) -> &mut Self
pub fn set_sql(&mut self, sql: &str) -> &mut Self
[src]
pub fn push_sql(&mut self, sql: &str) -> &mut Self
[src]
pub fn trim_sql(&mut self, sql: &str) -> &mut Self
[src]
pub fn trim_sql_start(&mut self, sql: &str) -> &mut Self
[src]
pub fn trim_sql_end(&mut self, sql: &str) -> &mut Self
[src]
pub fn and(&mut self) -> &mut Self
[src]
link wrapper sql, if end with where , do nothing
pub fn or(&mut self) -> &mut Self
[src]
link wrapper sql, if end with where , do nothing
pub fn having(&mut self, sql_having: &str) -> &mut Self
[src]
pub fn all_eq<T>(&mut self, arg: &T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
arg: JsonObject or struct{} or map[String,**]
pub fn eq<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn ne<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
not equal
pub fn order_by(&mut self, is_asc: bool, columns: &[&str]) -> &mut Self
[src]
pub fn group_by(&mut self, columns: &[&str]) -> &mut Self
[src]
pub fn gt<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
sql: column > obj
pub fn ge<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
sql: column >= obj
pub fn lt<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
sql: column < obj
pub fn le<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
sql: column <= obj
pub fn between<T>(&mut self, column: &str, min: T, max: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn not_between<T>(&mut self, column: &str, min: T, max: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn like<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn like_left<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn like_right<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn not_like<T>(&mut self, column: &str, obj: T) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn is_null(&mut self, column: &str) -> &mut Self
[src]
pub fn is_not_null(&mut self, column: &str) -> &mut Self
[src]
pub fn in_array<T>(&mut self, column: &str, obj: &[T]) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
pub fn not_in<T>(&mut self, column: &str, obj: &[T]) -> &mut Self where
T: Serialize,
[src]
T: Serialize,
Trait Implementations
impl Clone for Wrapper
[src]
impl Debug for Wrapper
[src]
impl<'de> Deserialize<'de> for Wrapper
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Wrapper
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Wrapper
impl Send for Wrapper
impl Sync for Wrapper
impl Unpin for Wrapper
impl !UnwindSafe for Wrapper
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,