Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Jan 18, 2022
1 parent 3f36ce3 commit f31327b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/query/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
/// [`InsertValueSource`] is a node in the expression tree and can represent a raw value set
/// ('VALUES') or a select query.
#[derive(Debug, Clone)]
pub enum InsertValueSource {
enum InsertValueSource {
Values(Vec<Vec<SimpleExpr>>),
Select(Box<SelectStatement>),
}
Expand Down Expand Up @@ -149,7 +149,7 @@ impl InsertStatement {
/// let query = Query::insert()
/// .into_table(Glyph::Table)
/// .columns(vec![Glyph::Aspect, Glyph::Image])
/// .select(Query::select()
/// .select_from(Query::select()
/// .column(Glyph::Aspect)
/// .column(Glyph::Image)
/// .from(Glyph::Table)
Expand All @@ -172,7 +172,7 @@ impl InsertStatement {
/// r#"INSERT INTO "glyph" ("aspect", "image") SELECT "aspect", "image" FROM "glyph" WHERE "image" LIKE '0%'"#
/// );
/// ```
pub fn select<S>(&mut self, select: S) -> Result<&mut Self>
pub fn select_from<S>(&mut self, select: S) -> Result<&mut Self>
where
S: Into<SelectStatement>,
{
Expand Down Expand Up @@ -222,7 +222,7 @@ impl InsertStatement {
/// r#"INSERT INTO "glyph" ("aspect", "image") SELECT "aspect", "image" FROM "glyph" WHERE "image" LIKE '0%'"#
/// );
/// ```
pub fn value_source<S>(&mut self, source: S) -> Result<&mut InsertStatement>
fn value_source<S>(&mut self, source: S) -> Result<&mut InsertStatement>
where
S: Into<InsertValueSource>,
{
Expand All @@ -233,7 +233,7 @@ impl InsertStatement {
}
Ok(self)
}
InsertValueSource::Select(select) => self.select(*select),
InsertValueSource::Select(select) => self.select_from(*select),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/mysql/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ fn insert_from_select() {
Query::insert()
.into_table(Glyph::Table)
.columns(vec![Glyph::Aspect, Glyph::Image])
.select(
.select_from(
Query::select()
.column(Glyph::Aspect)
.column(Glyph::Image)
Expand Down
2 changes: 1 addition & 1 deletion tests/postgres/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ fn insert_from_select() {
Query::insert()
.into_table(Glyph::Table)
.columns(vec![Glyph::Aspect, Glyph::Image])
.select(
.select_from(
Query::select()
.column(Glyph::Aspect)
.column(Glyph::Image)
Expand Down
2 changes: 1 addition & 1 deletion tests/sqlite/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ fn insert_from_select() {
Query::insert()
.into_table(Glyph::Table)
.columns(vec![Glyph::Aspect, Glyph::Image])
.select(
.select_from(
Query::select()
.column(Glyph::Aspect)
.column(Glyph::Image)
Expand Down

0 comments on commit f31327b

Please sign in to comment.