Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/entity/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub use crate::{
ColumnTypeTrait, ConnectionTrait, CursorTrait, DatabaseConnection, DbConn, EntityName,
EntityTrait, EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, LoaderTrait, ModelTrait,
PaginatorTrait, PrimaryKeyArity, PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult,
Related, RelatedSelfVia, RelationDef, RelationTrait, Select, Value,
Related, RelatedSelfVia, RelationDef, RelationTrait, Select, SelectExt, Value,
error::*,
sea_query::{DynIden, Expr, RcOrArc, SeaRc, StringLen},
};
Expand Down
2 changes: 2 additions & 0 deletions src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod paginator;
mod query;
mod returning;
mod select;
mod select_ext;
mod update;

use consolidate::*;
Expand All @@ -18,4 +19,5 @@ pub use paginator::*;
pub use query::*;
use returning::*;
pub use select::*;
pub use select_ext::*;
pub use update::*;
26 changes: 1 addition & 25 deletions src/executor/paginator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,31 +275,6 @@ where
{
self.paginate(db, 1).num_items().await
}

/// Check if any records exist
async fn exists(self, db: &'db C) -> Result<bool, DbErr>
where
Self: Send + Sized,
Comment on lines -280 to -282
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking whether we should keep this, at least leave behind a deprecated notice?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added in v2.0, so I think we can move it directly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, didn't even remember!

{
let paginator = self.paginate(db, 1);
let stmt = SelectStatement::new()
.expr(Expr::cust("1"))
.from_subquery(
paginator
.query
.clone()
.reset_limit()
.reset_offset()
.clear_order_by()
.limit(1)
.to_owned(),
"sub_query",
)
.limit(1)
.to_owned();
let result = db.query_one(&stmt).await?;
Ok(result.is_some())
}
}

impl<'db, C, S> PaginatorTrait<'db, C> for Selector<S>
Expand Down Expand Up @@ -400,6 +375,7 @@ mod tests {
#[cfg(feature = "sync")]
use crate::util::StreamShim;
use crate::{DatabaseConnection, DbBackend, MockDatabase, Transaction};
use crate::{QueryOrder, QuerySelect};
use crate::{Statement, tests_cfg::*};
use futures_util::{TryStreamExt, stream::TryNext};
use pretty_assertions::assert_eq;
Expand Down
Loading
Loading