Lifetime is not needed

This commit is contained in:
Chris Tsang 2021-05-08 17:48:37 +08:00
parent 4469b824e8
commit 9b7317d38c
3 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
use crate::{Connection, Database, EntityTrait, ModelTrait, QueryErr, Select};
impl<E: 'static> Select<'_, E>
impl<E: 'static> Select<E>
where
E: EntityTrait,
{

View File

@ -27,7 +27,7 @@ pub trait EntityTrait: Iden + Default + Debug {
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake`"
/// );
/// ```
fn find<'s>() -> Select<'s, Self> {
fn find() -> Select<Self> {
Select::new(Self::default())
}
@ -41,7 +41,7 @@ pub trait EntityTrait: Iden + Default + Debug {
/// "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();
select.query().limit(1);
select
@ -57,7 +57,7 @@ pub trait EntityTrait: Iden + Default + Debug {
/// "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
V: Into<Value>,
{

View File

@ -6,15 +6,15 @@ use sea_query::{Expr, Iden, IntoIden, Order, QueryBuilder, SelectStatement, Simp
use std::rc::Rc;
#[derive(Debug)]
pub struct Select<'s, E: 'static>
pub struct Select<E: 'static>
where
E: EntityTrait,
{
select: SelectStatement,
entity: PhantomData<&'s E>,
entity: PhantomData<E>,
}
impl<E: 'static> Select<'_, E>
impl<E: 'static> Select<E>
where
E: EntityTrait,
{