49 Commits

Author SHA1 Message Date
Chris Tsang
b3e4d1c1cf RecordNotFound -> RecordNotUpdated 2023-01-25 15:43:44 +08:00
Chris Tsang
85533a3bb3 Give up and fix tests 2022-08-28 14:54:26 +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
Chris Tsang
d5c9c65079 Revert save to return Self 2021-12-26 00:13:56 +08:00
Billy Chan
17631512bb
feat(Model): add wrapper method delete 2021-12-21 18:24:05 +08:00
Billy Chan
5104cd3573
Insert & Update Return Model (#339)
* Update insert & update API

* Update test cases

* Update README

* Fix clippy warnings

* Fixup

* Fixup
2021-12-18 14:30:10 +08:00
Billy Chan
f975223d9e
Fixup 2021-11-10 16:08:06 +08:00
Billy Chan
ac804a1642
Imports PaginatorTrait by default making it backward compatible 2021-11-10 15:26:29 +08:00
jasper
05181994d3 Move count to PaginatorTrait 2021-11-10 08:57:05 +08:00
jasper
23498892b0 Add PaginatorTrait and CountTrait 2021-11-09 21:33:55 +08:00
Billy Chan
8caed80fd7
Merge branch 'master' into last-insert-id 2021-10-06 22:38:43 +08:00
Billy Chan
11781082ba
Throw error if none of the db rows are affected 2021-09-30 10:31:21 +08:00
Billy Chan
9efaeeba8b
Update test cases 2021-09-27 18:02:20 +08:00
Billy Chan
dcaedd7d3a cargo fmt 2021-09-10 12:56:41 +08:00
Billy Chan
f4d1a52791 Change update behavior, add ActiveModel insert & update 2021-09-10 12:56:41 +08:00
Billy Chan
ca56f27909
cargo clippy 2021-09-03 16:20:57 +08:00
Billy Chan
8e2b7e561e
Testing composite primary keys 2021-09-02 11:47:57 +08:00
Billy Chan
333f199c1a
cargo fmt 2021-08-29 22:37:21 +08:00
Billy Chan
4d0c5f0b0f
Hotfix - Postgres errors 2021-08-29 22:11:19 +08:00
Billy Chan
752cc4a44e
WIP 2021-08-29 19:39:01 +08:00
Billy Chan
3bada7fbc3
WIP 2021-08-29 12:05:55 +08:00
Sam Samai
5930c4b278 Clean up 2021-08-06 21:17:49 +10:00
Sam Samai
402c003d84 WIP - failing for postgres on Customer::find().count(db).await.unwrap(); 2021-08-05 21:08:28 +10:00
Sam Samai
09dd290101 WIP 2 2021-08-02 21:21:35 +10:00
Sam Samai
abed934d3f WIP strange fail with postgres driver 2021-08-01 16:14:31 +10:00
Billy Chan
571210748f
cargo +nightly fmt 2021-07-26 14:56:56 +08:00
Sam Samai
dfda079b77 Store baker contact details as Json and test 2021-07-21 15:36:53 +10:00
Sam Samai
c9833893c0 Column type can be Uuid 2021-07-20 16:28:38 +10:00
Sam Samai
47b70cfe6d Create serial field on cake which is UUID 2021-07-19 17:23:34 +10:00
Sam Samai
74b5dee773 Test updating a deleted entity 2021-07-18 13:52:38 +10:00
Sam Samai
c1eddc4887 Test right_join 2021-07-15 10:52:36 +10:00
Sam Samai
85f512d412 Bakery chain Schema and CRUD now use data from common module 2021-07-15 10:42:25 +10:00
Sam Samai
2e0f6df743 Merge branch 'master' into ss/test_suite
# Conflicts:
#	Cargo.toml
2021-07-14 09:12:55 +10:00
Chris Tsang
1e6a778a0f ValueType does not need to impl Default 2021-07-12 02:48:37 +08:00
Sam Samai
a838cf7c23
Naivedatetime for placed_at on order (#40)
* WIP use NativeDateTime for placed_at

* Use NaiveDatetime for placed_at

* Cargo fmt again

Co-authored-by: Chris Tsang <tyt2y7@gmail.com>
2021-07-11 22:17:28 +08:00
Sam Samai
1fa7c7e177 Test delete cake and bakery 2021-07-10 22:07:57 +10:00
Sam Samai
f961e6e28d Test bakery update 2021-07-10 21:27:58 +10:00
Sam Samai
7ebfddae91 Test update cake 2021-07-10 21:20:51 +10:00
Sam Samai
550d9a7bcb Cake price is decimal now 2021-07-08 22:07:08 +10:00
Sam Samai
ad4c1c813c Test create order 2021-07-08 22:00:46 +10:00
Sam Samai
1ecc8480ab Test create lineitem 2021-07-08 21:43:19 +10:00
Sam Samai
f05de487ff Use Decimal for lineitem price 2021-07-07 21:46:21 +10:00
Sam Samai
0eeb37b219 Test create cake 2021-07-05 22:14:16 +10:00
Sam Samai
cf356ecfdb Test create customer 2021-07-05 21:50:18 +10:00
Sam Samai
a40785c554 Test baker and bakery create 2021-07-05 21:43:32 +10:00
Sam Samai
f61ed5a2cc Use DbErr instead of ExecErr 2021-07-03 22:14:13 +10:00
Sam Samai
f60a1c32a3 Test bakery create 2021-07-03 21:18:35 +10:00
Sam Samai
c820bb66f7 Fix relationship between Cake and lineitems, add Cake schema creation test 2021-06-30 21:16:44 +10:00
Sam Samai
391fb08260 Separate schema tests 2021-06-30 21:15:12 +10:00