42 Commits

Author SHA1 Message Date
Chris Tsang
1225255431 Address comments 2022-09-14 00:28:24 +08:00
Chris Tsang
0ce0f49551 Refactor SqlxError; 2022-08-28 13:51:21 +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
SandaruKasa
4f26b4a585
sqlx_logging_level, a wrapper around sqlx::ConnectOptions::log_statements (#800)
* sqlx_logging_level

* ` = { version = "..." }`
2022-06-26 18:29:44 +08:00
Billy Chan
4072e74284
cargo fmt 2021-12-17 11:14:54 +08:00
Marco Napetti
9a342546f3 use macro to simplify code, add failure boolean 2021-12-10 10:09:09 +01:00
Marco Napetti
aaf11dd265 Into doesn't works 2021-12-09 19:17:41 +01:00
Marco Napetti
4abe8310a5 Per-connection metric 2021-12-09 19:03:46 +01:00
Marco Napetti
6b94673dd9 First metric and tracing implementation 2021-12-09 15:12:41 +01:00
Billy Chan
da705f6629
Detailed connection errors 2021-11-11 16:58:11 +08:00
Charles Chege
e0023611a2 Improve documentation for the drivers and the entity
Provide module level code example on how to create an Entity, Model, ActiveModel, Column and PrimaryKey
2021-10-30 11:15:43 +03:00
Charles Chege
e4d115b5b0 Document the database drivers 2021-10-29 10:39:37 +03:00
Chris Tsang
1d6e6066cd Allow disable SQLx logging 2021-10-13 16:41:51 +08:00
Chris Tsang
c673017b97 ConnectOptions 2021-10-13 02:40:33 +08:00
Chris Tsang
e7b822c65d cargo fmt 2021-10-04 11:44:02 +08:00
Marco Napetti
02ebc9745c Transaction 3 2021-10-04 11:39:16 +08:00
baoyachi
d78a067b2d 'url_starts_with' replace with 'is_prefix_of' method 2021-09-27 16:41:47 +08:00
baoyachi
203a0d603a fix build error 2021-09-27 12:19:36 +08:00
baoyachi
1cf5cec1c5 refactor code 2021-09-27 12:13:06 +08:00
baoyachi
86f2d7e327 fix #200
* adapter postgrel url scheme
* refactor DbScheme
2021-09-27 11:45:54 +08:00
Billy Chan
3093cd2035 DatabaseConnection impl Sync, Send and Clone 2021-09-18 23:17:29 +08:00
Billy Chan
7f38621c3c
Set clippy deny 2021-09-03 14:26:57 +08:00
Chris Tsang
6ff5a32b7a cargo fmt 2021-07-11 22:08:37 +08:00
Chris Tsang
f5ac84f915 Rework DbErr 2021-06-30 23:56:26 +08:00
Chris Tsang
30ac326d5c Rename to DbErr::Exec and DbErr::Conn 2021-06-30 21:21:06 +08:00
Chris Tsang
0298cfb6af Rename to DbErr 2021-06-30 21:17:23 +08:00
Billy Chan
2a1173c174
Add & use OrmError (#36)
* Add & use OrmError

* Rename to SeaErr
2021-06-30 21:08:41 +08:00
Chris Tsang
ec290156c5 SQLx SQLite support 2021-06-20 23:04:25 +08:00
Chris Tsang
faffc518ae Mock test case 2021-06-13 23:38:21 +08:00
Chris Tsang
6b7ea75393 Mock Database Connection 2021-06-13 22:20:50 +08:00
Chris Tsang
c7057ab964 Organize code 2021-06-12 17:12:18 +08:00
Chris Tsang
981a5f731d Move code 2021-06-12 16:51:52 +08:00
Chris Tsang
162f6f4331 cargo fmt 2021-06-11 20:10:06 +08:00
Chris Tsang
398e1f0913 From sqlx pool 2021-06-11 15:48:26 +08:00
Chris Tsang
744d62a310 Change one() to return Option<Model> 2021-06-05 23:44:11 +08:00
Chris Tsang
99a1fe01fc cargo fmt 2021-05-27 02:34:14 +08:00
Chris Tsang
fcff91c0e4 Execute interface 2021-05-26 19:05:43 +08:00
Billy Chan
7aaeef834c
Move to separate DeriveActiveModel, cargo fmt 2021-05-25 18:27:44 +08:00
Chris Tsang
1a780d8e4f Move code 2021-05-24 22:29:17 +08:00
Chris Tsang
6ffed93b46 DatabaseConnection 2021-05-07 15:09:07 +08:00
Chris Tsang
7d99d33aa2 Select 2021-05-07 05:57:51 +08:00
Chris Tsang
af4fb2ab7d Initial Commit 2021-05-07 03:35:46 +08:00