Skip to content

Commit

Permalink
Merge branch 'SeaQL:master' into feat/postgresql-ltree
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanBorai authored Sep 9, 2023
2 parents 3094255 + edf747b commit af4ab9f
Show file tree
Hide file tree
Showing 40 changed files with 939 additions and 213 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ jobs:
with:
toolchain: nightly
components: rustfmt
- run: cargo fmt --all -- --check
- run: cargo fmt --manifest-path Cargo.toml --all -- --check
- run: cargo fmt --manifest-path sea-query-attr/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path sea-query-binder/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path sea-query-rusqlite/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path sea-query-derive/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path sea-query-postgres/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path sea-query-rusqlite/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path examples/sqlx_sqlite/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path examples/sqlx_any/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path examples/rusqlite/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path examples/sqlx_postgres/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path examples/postgres/Cargo.toml --all -- --check
- run: cargo fmt --manifest-path examples/sqlx_mysql/Cargo.toml --all -- --check

clippy:
name: Clippy
Expand Down Expand Up @@ -247,3 +255,12 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --manifest-path examples/${{ matrix.example }}/Cargo.toml
- run: cargo run --manifest-path examples/${{ matrix.example }}/Cargo.toml

any:
name: Any
runs-on: ubuntu-latest
needs: ["test", "derive-test", "binder-build"]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --manifest-path examples/sqlx_any/Cargo.toml
57 changes: 55 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,63 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.30.2 - Pending

### Bug Fixes

* Fixed incorrect behavior when adding an autoincrement column for Postgres https://github.com/SeaQL/sea-query/pull/697

## 0.30.1 - 2023-08-25

### Versions

+ [`sea-query-postgres`/`0.4.0`](https://crates.io/crates/sea-query-postgres/0.4.0)
+ [`sea-query-rusqlite`/`0.4.0`](https://crates.io/crates/sea-query-rusqlite/0.4.0)
+ [`sea-query-rbatis`/`0.1.0`](https://crates.io/crates/sea-query-rbatis/0.1.0)

### New Features

* Added `Func::round` and `Func::round_with_precision` https://github.com/SeaQL/sea-query/pull/671

### Enhancements

* Added some getters to `FunctionCall` https://github.com/SeaQL/sea-query/pull/677

### Bug Fixes

* Fixed bytea literal syntax for Postgres https://github.com/SeaQL/sea-query/pull/666
* Fixed issues with semantics of parenthesis removal https://github.com/SeaQL/sea-query/pull/675
* Fixed behaviour in `FunctionCall` when calling `arg` multiple times https://github.com/SeaQL/sea-query/pull/687

### Breaking changes

* As part of https://github.com/SeaQL/sea-query/pull/687, calling `FunctionCall::arg` multiple times will append the arguments instead of replacing old values

## 0.30.0 - 2023-07-20

This is a small (but major) upgrade, the only changes are:

* Upgrade [SQLx to `0.7`](https://github.com/launchbadge/sqlx/blob/main/CHANGELOG.md#071---2023-07-14) https://github.com/SeaQL/sea-query/pull/652
* Upgrade ipnetwork to `0.20`

### Versions

+ [`sea-query-binder`/`0.5.0`](https://crates.io/crates/sea-query-binder/0.5.0)

### Notes

`sea-query 0.29` has a number of breaking changes, so it might be easier for you to first upgrade to `0.29`, then upgrade `sqlx` by bumping to `0.30`.

## 0.29.1 - 2023-07-12

+ `0.29.0-rc.1`: 2023-03-22
+ `0.29.0`: Yanked
### Versions

+ `sea-query`/`0.29.0-rc.1`: 2023-03-22
+ `sea-query`/`0.29.0` (Yanked)
+ `sea-query`/`0.29.1`: 2023-07-12
+ [`sea-query-binder`/`0.4.0`](https://crates.io/crates/sea-query-binder/0.4.0)
+ [`sea-query-postgres`/`0.3.0`](https://crates.io/crates/sea-query-postgres/0.3.0)
+ [`sea-query-rusqlite`/`0.3.0`](https://crates.io/crates/sea-query-rusqlite/0.3.0)

### New Features

Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = [".", "sea-query-derive"]

[package]
name = "sea-query"
version = "0.29.1"
version = "0.31.0"
authors = [
"Chris Tsang <[email protected]>",
"Billy Chan <[email protected]>",
Expand Down Expand Up @@ -33,15 +33,15 @@ sea-query-attr = { version = "0.1.1", path = "sea-query-attr", default-features
sea-query-derive = { version = "0.4.0", path = "sea-query-derive", default-features = false, optional = true }
serde_json = { version = "1", default-features = false, optional = true, features = ["std"] }
derivative = { version = "2.2", default-features = false, optional = true }
chrono = { version = "0.4", default-features = false, optional = true, features = ["clock"] }
chrono = { version = "0.4.27", default-features = false, optional = true, features = ["clock"] }
postgres-types = { version = "0", default-features = false, optional = true }
rust_decimal = { version = "1", default-features = false, optional = true }
bigdecimal = { version = "0.3", default-features = false, optional = true }
uuid = { version = "1", default-features = false, optional = true }
proc-macro2 = { version = "1", default-features = false, optional = true }
quote = { version = "1", default-features = false, optional = true }
time = { version = "0.3", default-features = false, optional = true, features = ["macros", "formatting"] }
ipnetwork = { version = "0.19", default-features = false, optional = true }
ipnetwork = { version = "0.20", default-features = false, optional = true }
mac_address = { version = "1.1", default-features = false, optional = true }
ordered-float = { version = "3.4", default-features = false, optional = true }

Expand Down
1 change: 1 addition & 0 deletions examples/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name = "sea-query-postgres-example"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
chrono = { version = "0.4", default-features = false, features = ["clock"] }
Expand Down
3 changes: 2 additions & 1 deletion examples/rusqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
name = "sea-query-rusqlite-example"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
chrono = { version = "0.4", default-features = false, features = ["clock"] }
time = { version = "0.3", features = ["parsing", "macros"] }
serde_json = { version = "1" }
# rusqlite only supports uuid 0
uuid = { version = "1", features = ["serde", "v4"] }
rusqlite = "0.28"
rusqlite = "0.29"
sea-query = { path = "../.."}
sea-query-rusqlite = { path = "../../sea-query-rusqlite", features = [
"with-chrono",
Expand Down
3 changes: 2 additions & 1 deletion examples/sqlx_any/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name = "sea-query-sqlx-any-example"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
chrono = { version = "0.4", default-features = false, features = ["clock"] }
Expand All @@ -14,7 +15,7 @@ serde_json = "1"
rust_decimal = { version = "1" }
bigdecimal = { version = "0.3" }
async-std = { version = "1.8", features = [ "attributes" ] }
sqlx = "0.6"
sqlx = "0.7"
sea-query = { path = "../../" }
sea-query-binder = { path = "../../sea-query-binder", features = [
"sqlx-postgres",
Expand Down
22 changes: 11 additions & 11 deletions examples/sqlx_any/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use chrono::{NaiveDate, NaiveDateTime};
use chrono::NaiveDate;
use sea_query::{
ColumnDef, Expr, Func, Iden, MysqlQueryBuilder, OnConflict, Order, PostgresQueryBuilder, Query,
QueryBuilder, SchemaBuilder, SqliteQueryBuilder, Table,
Expand Down Expand Up @@ -65,7 +65,7 @@ async fn main() {
.col(ColumnDef::new(Character::Created).date_time())
.build_any(schema_builder);

let result = sqlx::query(&sql).execute(&mut pool).await;
let result = sqlx::query(&sql).execute(&mut *pool).await;
println!("Create table character: {result:?}\n");

// Create
Expand All @@ -90,7 +90,7 @@ async fn main() {
.build_any_sqlx(query_builder);

let row = sqlx::query_with(&sql, values)
.fetch_one(&mut pool)
.fetch_one(&mut *pool)
.await
.unwrap();
let id: i32 = row.try_get(0).unwrap();
Expand All @@ -111,7 +111,7 @@ async fn main() {
.build_any_sqlx(query_builder);

let rows = sqlx::query_as_with::<_, CharacterStructChrono, _>(&sql, values)
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select one from character:");
Expand All @@ -128,7 +128,7 @@ async fn main() {
.and_where(Expr::col(Character::Id).eq(id))
.build_any_sqlx(query_builder);

let result = sqlx::query_with(&sql, values).execute(&mut pool).await;
let result = sqlx::query_with(&sql, values).execute(&mut *pool).await;
println!("Update character: {result:?}\n");

// Read
Expand All @@ -146,7 +146,7 @@ async fn main() {
.build_any_sqlx(query_builder);

let rows = sqlx::query_as_with::<_, CharacterStructChrono, _>(&sql, values)
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select one from character:");
Expand All @@ -163,7 +163,7 @@ async fn main() {
.build_any_sqlx(query_builder);

let row = sqlx::query_with(&sql, values)
.fetch_one(&mut pool)
.fetch_one(&mut *pool)
.await
.unwrap();
print!("Count character: ");
Expand All @@ -184,7 +184,7 @@ async fn main() {
)
.build_any_sqlx(query_builder);

let result = sqlx::query_with(&sql, values).execute(&mut pool).await;
let result = sqlx::query_with(&sql, values).execute(&mut *pool).await;
println!("Insert into character (with upsert): {result:?}\n");

// Read
Expand All @@ -201,7 +201,7 @@ async fn main() {
.build_any_sqlx(query_builder);

let rows = sqlx::query_as_with::<_, CharacterStructChrono, _>(&sql, values)
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select all characters:");
Expand All @@ -217,7 +217,7 @@ async fn main() {
.and_where(Expr::col(Character::Id).eq(id))
.build_any_sqlx(query_builder);

let result = sqlx::query_with(&sql, values).execute(&mut pool).await;
let result = sqlx::query_with(&sql, values).execute(&mut *pool).await;
println!("Delete character: {result:?}");
}

Expand All @@ -236,5 +236,5 @@ struct CharacterStructChrono {
id: i32,
character: String,
font_size: i32,
created: NaiveDateTime,
created: String,
}
3 changes: 2 additions & 1 deletion examples/sqlx_mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name = "sea-query-sqlx-mysql-example"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
chrono = { version = "0.4", default-features = false, features = ["clock"] }
Expand All @@ -14,7 +15,7 @@ serde_json = "1"
rust_decimal = { version = "1" }
bigdecimal = { version = "0.3" }
async-std = { version = "1.8", features = [ "attributes" ] }
sqlx = "0.6"
sqlx = "0.7"
sea-query = { path = "../../" }
sea-query-binder = { path = "../../sea-query-binder", features = [
"sqlx-mysql",
Expand Down
24 changes: 12 additions & 12 deletions examples/sqlx_mysql/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async fn main() {
.col(ColumnDef::new(Character::Created).date_time())
.build(MysqlQueryBuilder);

let result = sqlx::query(&sql).execute(&mut pool).await;
let result = sqlx::query(&sql).execute(&mut *pool).await;
println!("Create table character: {result:?}\n");

// Create
Expand Down Expand Up @@ -92,7 +92,7 @@ async fn main() {
])
.build_sqlx(MysqlQueryBuilder);

let result = sqlx::query_with(&sql, values).execute(&mut pool).await;
let result = sqlx::query_with(&sql, values).execute(&mut *pool).await;
println!("Insert into character: {result:?}\n");
let id = result.unwrap().last_insert_id();

Expand All @@ -115,7 +115,7 @@ async fn main() {
.build_sqlx(MysqlQueryBuilder);

let rows = sqlx::query_as_with::<_, CharacterStructChrono, _>(&sql, values.clone())
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select one from character:");
Expand All @@ -125,7 +125,7 @@ async fn main() {
println!();

let rows = sqlx::query_as_with::<_, CharacterStructTime, _>(&sql, values)
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select one from character:");
Expand All @@ -142,7 +142,7 @@ async fn main() {
.and_where(Expr::col(Character::Id).eq(id))
.build_sqlx(MysqlQueryBuilder);

let result = sqlx::query_with(&sql, values).execute(&mut pool).await;
let result = sqlx::query_with(&sql, values).execute(&mut *pool).await;
println!("Update character: {result:?}\n");

// Read
Expand All @@ -164,7 +164,7 @@ async fn main() {
.build_sqlx(MysqlQueryBuilder);

let rows = sqlx::query_as_with::<_, CharacterStructChrono, _>(&sql, values.clone())
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select one from character:");
Expand All @@ -174,7 +174,7 @@ async fn main() {
println!();

let rows = sqlx::query_as_with::<_, CharacterStructTime, _>(&sql, values)
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select one from character:");
Expand All @@ -197,7 +197,7 @@ async fn main() {
)
.build_sqlx(MysqlQueryBuilder);

let result = sqlx::query_with(&sql, values).execute(&mut pool).await;
let result = sqlx::query_with(&sql, values).execute(&mut *pool).await;
println!("Insert into character (with upsert): {result:?}\n");
let id = result.unwrap().last_insert_id();

Expand All @@ -219,7 +219,7 @@ async fn main() {
.build_sqlx(MysqlQueryBuilder);

let rows = sqlx::query_as_with::<_, CharacterStructChrono, _>(&sql, values.clone())
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select all characters:");
Expand All @@ -229,7 +229,7 @@ async fn main() {
println!();

let rows = sqlx::query_as_with::<_, CharacterStructTime, _>(&sql, values)
.fetch_all(&mut pool)
.fetch_all(&mut *pool)
.await
.unwrap();
println!("Select all characters:");
Expand All @@ -246,7 +246,7 @@ async fn main() {
.build_sqlx(MysqlQueryBuilder);

let row = sqlx::query_with(&sql, values)
.fetch_one(&mut pool)
.fetch_one(&mut *pool)
.await
.unwrap();
print!("Count character: ");
Expand All @@ -261,7 +261,7 @@ async fn main() {
.and_where(Expr::col(Character::Id).eq(id))
.build_sqlx(MysqlQueryBuilder);

let result = sqlx::query_with(&sql, values).execute(&mut pool).await;
let result = sqlx::query_with(&sql, values).execute(&mut *pool).await;
println!("Delete character: {result:?}");
}

Expand Down
Loading

0 comments on commit af4ab9f

Please sign in to comment.