Lifetime is not needed
This commit is contained in:
parent
4469b824e8
commit
9b7317d38c
@ -1,6 +1,6 @@
|
|||||||
use crate::{Connection, Database, EntityTrait, ModelTrait, QueryErr, Select};
|
use crate::{Connection, Database, EntityTrait, ModelTrait, QueryErr, Select};
|
||||||
|
|
||||||
impl<E: 'static> Select<'_, E>
|
impl<E: 'static> Select<E>
|
||||||
where
|
where
|
||||||
E: EntityTrait,
|
E: EntityTrait,
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ pub trait EntityTrait: Iden + Default + Debug {
|
|||||||
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake`"
|
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake`"
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
fn find<'s>() -> Select<'s, Self> {
|
fn find() -> Select<Self> {
|
||||||
Select::new(Self::default())
|
Select::new(Self::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ pub trait EntityTrait: Iden + Default + Debug {
|
|||||||
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` LIMIT 1"
|
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` LIMIT 1"
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
fn find_one<'s>() -> Select<'s, Self> {
|
fn find_one() -> Select<Self> {
|
||||||
let mut select = Self::find();
|
let mut select = Self::find();
|
||||||
select.query().limit(1);
|
select.query().limit(1);
|
||||||
select
|
select
|
||||||
@ -57,7 +57,7 @@ pub trait EntityTrait: Iden + Default + Debug {
|
|||||||
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = 11 LIMIT 1"
|
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = 11 LIMIT 1"
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
fn find_one_by<'s, V>(v: V) -> Select<'s, Self>
|
fn find_one_by<V>(v: V) -> Select<Self>
|
||||||
where
|
where
|
||||||
V: Into<Value>,
|
V: Into<Value>,
|
||||||
{
|
{
|
||||||
|
@ -6,15 +6,15 @@ use sea_query::{Expr, Iden, IntoIden, Order, QueryBuilder, SelectStatement, Simp
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Select<'s, E: 'static>
|
pub struct Select<E: 'static>
|
||||||
where
|
where
|
||||||
E: EntityTrait,
|
E: EntityTrait,
|
||||||
{
|
{
|
||||||
select: SelectStatement,
|
select: SelectStatement,
|
||||||
entity: PhantomData<&'s E>,
|
entity: PhantomData<E>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: 'static> Select<'_, E>
|
impl<E: 'static> Select<E>
|
||||||
where
|
where
|
||||||
E: EntityTrait,
|
E: EntityTrait,
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user