Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[index] support all statement #5060

Merged
merged 1 commit into from
Dec 18, 2022
Merged
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
13 changes: 4 additions & 9 deletions crates/indexer/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,13 @@ pub fn new_db_pool(database_url: &str) -> Result<PgDbPool, PoolError> {
PgPool::builder().build(manager).map(Arc::new)
}

pub fn execute_with_better_error<
T: diesel::Table + diesel::QuerySource + diesel::query_builder::QueryId + 'static,
U: diesel::query_builder::QueryFragment<diesel::pg::Pg>
+ diesel::query_builder::QueryId
+ diesel::insertable::CanInsertInSingleQuery<diesel::pg::Pg>,
>(
pub fn execute_with_better_error<U>(
conn: &mut PgConnection,
query: diesel::query_builder::InsertStatement<T, U>,
query: U,
mut additional_where_clause: Option<&'static str>,
) -> diesel::QueryResult<usize>
) -> QueryResult<usize>
where
<T as diesel::QuerySource>::FromClause: diesel::query_builder::QueryFragment<diesel::pg::Pg>,
U: QueryFragment<Pg> + diesel::query_builder::QueryId,
{
let original_query = diesel::debug_query::<diesel::pg::Pg, _>(&query).to_string();
// This is needed because if we don't insert any row, then diesel makes a call like this
Expand Down