767 Commits

Author SHA1 Message Date
Billy Chan
a0b3c58c5f
README 2022-11-14 14:43:14 +08:00
Chris Tsang
d082340848
Composite key cursor pagination (#1216)
* Composite key cursor pagination

* Fix Composite key of 3
2022-11-14 14:26:56 +08:00
Jacob Trueb
cf4657e127
Add Insert query execution without RETURNING clause (#1208) 2022-11-11 11:16:05 +08:00
e-rhodes
69612fa507
Fix typo in error name (#1180)
* fix typo in error name

* fixed typo in docs

Co-authored-by: erhodes <erik@space-nav.com>
2022-11-06 14:18:07 +08:00
Marco Napetti
9d25ee9ac1
use GAT to elide StreamTrait lifetime (#1161) 2022-11-06 12:55:21 +08:00
Marco Napetti
9f2a6dc40b
Fix transaction metrics (#1165) 2022-10-28 01:00:04 +08:00
Billy Chan
fdb3cff29f
SQLite support time crate (#995)
* SQLite support `time` crate

* Serialize time types for SQLite query results
2022-10-27 14:35:39 +08:00
Billy Chan
a766500ebf
Cont. "Enable convert from ActiveModel to Model" (#990)
* Changelog

* Enable convert from ActiveModel to Model (#725)

* feat: enable convert from ActiveModel to Model

* feat: add tests for converting from ActiveModel to Model

* cargo fmt

* Refactoring

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

* Fix clippy warnings

* Use error type

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
Co-authored-by: greenhandatsjtu <40566803+greenhandatsjtu@users.noreply.github.com>
2022-10-23 23:12:22 +08:00
Billy Chan
b91ca2b778
Implements fmt::Display for ActiveEnum (#986)
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-10-23 22:29:31 +08:00
Billy Chan
b5b9790252
Support array datatype in PostgreSQL (#1132)
* PostgreSQL array (draft)

* Fixup

* Fixup

* Fixup

* Fixup

* Fixup

* Refactoring

* generate entity for Postgres array fields

* Add tests

* Update Cargo.toml

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-10-23 18:26:57 +08:00
Billy Chan
4df9a2672a
Fixup 2022-10-18 19:06:38 +08:00
Ivan Krivosheev
3219e6ff42
Merge branch 'master' into sea-query-v0.27 2022-10-17 21:50:48 +03:00
Billy Chan
a0fd72e635
Serialize time types as serde_json::Value (#1042)
* Implement `IntoActiveValue` for `time` types.

I tried to implement a [custom active
model](https://www.sea-ql.org/SeaORM/docs/advanced-query/custom-active-model/),
and one of the columns was `Option<TimeDateTimeWithTimeZone>`. I got a
compiler error:

```
error[E0277]: the trait bound `std::option::Option<sea_orm::prelude::TimeDateTimeWithTimeZone>: IntoActiveValue<_>` is not satisfied
```

Looking into the source code, it seemed a simple oversight that this
trait was implemented for the `chrono` types but not the `time` types,
and it was easy enough to fix since there's already a macro to implement
it for new types.

I also noticed that the `time` types are not accounted for in
`src/query/json.rs` while the `chrono` types are, which I assume is also
an oversight. However, I don't have a need for that at this point and
the fix for that seemed less trivial, so I'm just bringing it to your
attention.

Thanks for SeaORM!

* Implement `IntoActiveValue` for `Vec<u8>` types

* Add tests to double check and prevent it from happening again

* Add docs

* Fixup

* Serialize `time` types as `serde_json::Value`

Co-authored-by: Jimmy Cuadra <jimmy@jimmycuadra.com>
2022-10-18 00:04:03 +08:00
Billy Chan
468cbb9baf
Fixup 2022-10-17 22:00:42 +08:00
Chris Tsang
bfab8720b4 Improve error messages #1125 2022-10-17 21:11:16 +08:00
Billy Chan
29da37b4f2
Merge branch 'master' into sea-query-v0.27 2022-10-17 17:53:41 +08:00
Billy Chan
671d79469a
Fixup 2022-10-17 17:25:35 +08:00
Billy Chan
b22db842e4
Run migrations on PostgreSQL schema (#1056)
* Run migrations on PostgreSQL schema

* fmt

* fmt & clippy

* clippy

* [cli] update helper text
2022-10-17 17:16:00 +08:00
Billy Chan
e76cbb9fe1
Add into_model & into_json for Cursor (#1112) 2022-10-16 19:02:48 +08:00
Billy Chan
0ca62ba145
Links to cookbook 2022-10-13 21:24:17 +08:00
wdcocq
880147c596
Blanket IntoActiveValue implementations so custom db types are supported (#833)
* Add blanket implementations of IntoActiveValue for optional values

* Add a compile test for DeriveIntoActiveModel
2022-10-11 23:47:17 +08:00
Chris Tsang
5d752e60b9
Merge pull request #1002 from SeaQL/better-errors
Better error system
2022-10-07 00:24:41 +08:00
Chris Tsang
a44017f679 Reorder variants 2022-10-07 00:15:36 +08:00
Billy Chan
3c19d7c3e4
Exclude test_cfg module from SeaORM (#1077) 2022-10-06 23:45:09 +08:00
Billy Chan
5f1670329d
Trim spaces when paginating raw SQL (#1094) 2022-10-06 23:38:45 +08:00
Horu
49c1a6d716
docs(readme): fix architecture link (#1086) 2022-10-03 12:12:39 +08:00
kyoto7250
ba5a83d3a8
distinct support in sea-orm (#902)
* distinct support

* remove feature flag

* fix argument
2022-09-25 10:21:44 +08:00
Billy Chan
6ba8e1b9f1
DeriveRelation on empty Relation enum (#1019) 2022-09-25 10:17:39 +08:00
Billy Chan
75e2570811
Fix Rust 1.64 clippy (#1064) 2022-09-23 15:32:03 +08:00
Billy Chan
77bddd85a5
Fixup 2022-09-22 15:07:37 +08:00
Billy Chan
968fc2e678
Configure acquire timeout for connection pool (#897)
* Reproduce "failed to acquire connection from pool" error

* Configure acquire_timeout

* Add tests

* Fixup

* Remove tests
2022-09-19 23:50:11 +08:00
Billy Chan
8ecb4fccba
Implement IntoActiveValue for Vec<u8> types 2022-09-15 15:40:34 +08:00
Jimmy Cuadra
bde43f51f8 Implement IntoActiveValue for time types.
I tried to implement a [custom active
model](https://www.sea-ql.org/SeaORM/docs/advanced-query/custom-active-model/),
and one of the columns was `Option<TimeDateTimeWithTimeZone>`. I got a
compiler error:

```
error[E0277]: the trait bound `std::option::Option<sea_orm::prelude::TimeDateTimeWithTimeZone>: IntoActiveValue<_>` is not satisfied
```

Looking into the source code, it seemed a simple oversight that this
trait was implemented for the `chrono` types but not the `time` types,
and it was easy enough to fix since there's already a macro to implement
it for new types.

I also noticed that the `time` types are not accounted for in
`src/query/json.rs` while the `chrono` types are, which I assume is also
an oversight. However, I don't have a need for that at this point and
the fix for that seemed less trivial, so I'm just bringing it to your
attention.

Thanks for SeaORM!
2022-09-14 22:58:05 -07:00
Chris Tsang
1225255431 Address comments 2022-09-14 00:28:24 +08:00
Ivan Krivosheev
ab5b488860
Merge branch 'sea-query-v0.27' into feature/issues-969_sea-query-binder 2022-09-08 12:59:09 +03:00
Ivan Krivosheev
ecbd7c2713 issues-969 Update dependencies
issues-969 Fix sqlx_query function
2022-09-08 12:56:32 +03:00
Ivan Krivosheev
581684c441 issues-969 Replace sea-query-driver to sea-query-binder 2022-09-08 12:54:37 +03:00
Billy Chan
a80c33ef4c
Rewrite enum and text casting (#973)
* Rewrite enum and text casting

* Add doc tests

* Refactoring
2022-09-05 00:38:12 +08:00
Chris Tsang
36f09c524e
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:45:17 +08:00
Chris Tsang
4993c6ab2d
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:45:09 +08:00
Chris Tsang
4d95218430
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:44:59 +08:00
Chris Tsang
1c8ef33544
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:44:45 +08:00
Billy Chan
0efdfc6742
Typo 2022-09-01 15:57:58 +08:00
Chris Tsang
85533a3bb3 Give up and fix tests 2022-08-28 14:54:26 +08:00
Chris Tsang
0ce0f49551 Refactor SqlxError; 2022-08-28 13:51:21 +08:00
Chris Tsang
348e841139 Refactor ColumnFromStrErr 2022-08-28 13:30:51 +08:00
Chris Tsang
0b754eab0b Refactor Type Errors 2022-08-28 12:59:33 +08:00
mohs8421
fe6c40dd75
Introducing sqlx-error feature (#750)
* feat: Introducing feature "sqlx-error"

Purpose of this feature is to not convert errors given from sqlx into strings to ease further analysis of the error and react to it accordingly. This implementation uses a feature switch and an additional error kind to avoid interfering with existing implementations without this feature enabled.
See discussion https://github.com/SeaQL/sea-orm/discussions/709

* fix: Align feature "sqlx-error" with merged Migration error kind

Due to the merge, an other error kind had been introduced and the DbErr became Eq and Clone, however Eq cannot easily be derived from, so I went back to PartialEq, and since the sqlx error does not implement clone, this was converted into an Arc, to allow cloning of the new kind too.

* fix: Repairing failing jobs

Several jobs had failed as I missed to correct the return values of a few methods in transaction.rs and had a wrong understanding of map_err at that point.

* feat: realigning with latest changes in sea-orm, different approach

Instead of the former approach to introduce a new error kind, now the existing error types get extended, for now only Exec and Query, because these are the most relevant for the requirement context.
Afterwards it might still be possible to add some further detail information.
See discussion https://github.com/SeaQL/sea-orm/discussions/709

* Update src/driver/sqlx_mysql.rs

Integrating fixes done by @Sculas

Co-authored-by: Sculas <contact@sculas.xyz>

* Update src/driver/sqlx_postgres.rs

Integrating fixes done by @Sculas

Co-authored-by: Sculas <contact@sculas.xyz>

* Update src/driver/sqlx_sqlite.rs

Integrating fixes done by @Sculas

Co-authored-by: Sculas <contact@sculas.xyz>

* feat: reworking feature with thiserror

Following the latest suggestions I changed the implementation to utilize `thiserror`.
Now there are more error kinds to be able to see the different kinds directly in src/error.rs
To ensure the behaviour is as expected, I also introduce a further test, which checks for a uniqueness failure.

Co-authored-by: Sculas <contact@sculas.xyz>
2022-08-28 11:13:51 +08:00
Billy Chan
af0bc7a0eb
Upgrade SeaORM root's SeaQuery to v0.27 2022-08-24 15:19:15 +08:00
liberwang1013
fff0c87a6d
replaced usize with u64 in PaginatorTrait (#789)
undefined
2022-08-20 22:43:17 +08:00