25 Commits

Author SHA1 Message Date
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
1a3e8c456a
[CI] run clippy checks & fix clippy warnings (#840)
* Run clippy checks

* Fix clippy warnings

* Clippy checks for `sea-orm-*` crates

* Fix clippy warnings

* Fixup
2022-07-10 15:38:38 +08:00
Billy Chan
d6831e5295
Bump version of sqlx, sea-query, sea-schema, time and uuid (#834)
* Bump version of sqlx, sea-query, sea-schema, time and uuid

* PostgreSQL `u32` was wrapped in `Oid` (launchbadge/sqlx#1602)

* Update test cases

* Fix clippy warnings

* cargo fmt

* Fix clippy warnings

* Bump sea-schema to ^0.9.2

* Update test cases

* Pin on sea-query minor version
2022-07-05 01:05:11 +08:00
Allen
bdd9133aa6 fix lints and warnings
also clean up impl_into_active_value macro
2022-04-09 16:52:47 -07:00
Billy Chan
c504f42cb3
Fixing and testing into_json of various field types (#539)
* Fixing and testing `into_json` of various types

* Support `into_json` for UUID

* Testing `into_json` for UUID

* Fixup
2022-03-24 22:38:45 +08:00
Marco Napetti
e80aa07c7c
Add Send to StreamTrait (#622)
* update ouroboros

* Add Send to StreamTrait
2022-03-22 17:17:07 +08:00
Billy Chan
09c328bb0d Use smol async-runtime and require one of the supported runtime for integration tests 2021-08-21 22:56:48 +08:00
Billy Chan
2cfaa34a33 Test against all supported runtime 2021-08-21 22:56:48 +08:00
Billy Chan
22516b8f68 Add Postgres db driver 2021-07-21 19:07:02 +08:00
Chris Tsang
9334d4ff5d DbBackend alias 2021-07-17 22:03:41 +08:00
Billy Chan
e83cc63e3a Replacing Syntax & *BuilderBackend with DatabaseBackend 2021-07-16 00:28:03 +08:00
Billy Chan
d59ee1e298 Mock any database 2021-07-14 21:31:59 +08:00
Chris Tsang
6ff5a32b7a cargo fmt 2021-07-11 22:08:37 +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
ad3fb45253 cargo fmt 2021-06-22 01:30:26 +08:00
Chris Tsang
ec290156c5 SQLx SQLite support 2021-06-20 23:04:25 +08:00
Chris Tsang
5002c62b40 Use DatabaseConnection in place of Database 2021-06-19 17:28:07 +08:00
Billy Chan
62fb43c605
Add unit test for pagination (#20)
* Add unit test for pagination

* End with empty page

* Add more test cases

* Assert transaction log

* Test utils

* Feature gated

* IntoMockRow, derive macro with into MockRow

* Revert derive macro

* WIP

* WIP

* assert_transaction_log
2021-06-18 23:43:07 +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
b818138724 cargo fmt 2021-06-06 22:42:53 +08:00
Billy Chan
937af05003
Paginator API (#10)
* Paginator

* Remove unnecessary dependency, rename to num_pages

* Hotfix - nullable json value

* num_pages implemented on sub_query
2021-06-06 22:30:54 +08:00
Chris Tsang
1613a57c19 Tweak 2021-05-27 15:19:15 +08:00
Chris Tsang
97e6bb3433 Refactor JSON 2021-05-27 03:45:47 +08:00