Skip to content

Commit

Permalink
Impl QueryStatementWriter for WithQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Dec 1, 2023
1 parent eafdae1 commit 58e7909
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions sea-query-binder/src/sqlx_any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ impl<'q> sqlx::IntoArguments<'q, sqlx::any::Any> for SqlxValues {
}
#[cfg(feature = "with-ipnetwork")]
Value::IpNetwork(_) => {
panic!("SeaQuery doesn't support IpNetwork arguments for Any");
panic!("SQLx doesn't support IpNetwork arguments for Any");
}
#[cfg(feature = "with-mac_address")]
Value::MacAddress(_) => {
panic!("SeaQuery doesn't support MacAddress arguments for Any");
panic!("SQLx doesn't support MacAddress arguments for Any");
}
#[cfg(feature = "postgres-array")]
Value::Array(_, _) => {
panic!("SeaQuery doesn't support array arguments for Any");
panic!("SQLx doesn't support array arguments for Any");
}
}
}
Expand Down
29 changes: 16 additions & 13 deletions src/query/with.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
use crate::ColumnRef;
use crate::DynIden;
use crate::IntoIden;
use crate::QueryStatementBuilder;
use crate::QueryStatementWriter;
use crate::SelectExpr;
use crate::SelectStatement;
use crate::SimpleExpr;
use crate::SqlWriter;
use crate::SubQueryStatement;
use crate::TableRef;
use crate::{Alias, QueryBuilder};
use crate::{
ColumnRef, DynIden, IntoIden, QueryStatementBuilder, QueryStatementWriter, SelectExpr,
SelectStatement, SimpleExpr, SqlWriter, SubQueryStatement, TableRef, Values,
{Alias, QueryBuilder},
};
use inherent::inherent;

/// A table definition inside a WITH clause ([WithClause]).
///
Expand Down Expand Up @@ -594,8 +588,17 @@ impl QueryStatementBuilder for WithQuery {
}
}

#[inherent]
impl QueryStatementWriter for WithQuery {
fn build_collect_into<T: QueryBuilder>(&self, query_builder: T, sql: &mut dyn SqlWriter) {
pub fn build_collect_into<T: QueryBuilder>(&self, query_builder: T, sql: &mut dyn SqlWriter) {
query_builder.prepare_with_query(self, sql);
}

pub fn build_collect<T: QueryBuilder>(
&self,
query_builder: T,
sql: &mut dyn SqlWriter,
) -> String;
pub fn build<T: QueryBuilder>(&self, query_builder: T) -> (String, Values);
pub fn to_string<T: QueryBuilder>(&self, query_builder: T) -> String;
}

0 comments on commit 58e7909

Please sign in to comment.