94 Commits

Author SHA1 Message Date
Chris Tsang
d14e4a2160 Fix again 2023-01-09 15:20:01 +08:00
Chris Tsang
5c93253877 Tests 2023-01-09 14:46:19 +08:00
Chris Tsang
f0634c2451 Well clippy 2023-01-09 14:26:11 +08:00
Chris Tsang
566dac0661 Docs 2023-01-09 14:11:57 +08:00
Chris Tsang
a11c57d337 Introduce ColIdx 2023-01-09 14:02:23 +08:00
Billy Chan
5291c7f551
clippy 2022-12-20 15:56:37 +08:00
Billy Chan
3cd834d40c
docs 2022-12-20 15:43:03 +08:00
Billy Chan
70c4a3a23e
Select into tuple 2022-12-15 21:24:10 +08:00
Billy Chan
3de0078a31
Optimize TryGetableFromJson (#1249) 2022-12-01 13:23:24 +08:00
Billy Chan
08cb44028e
Support bigdecimal::BigDecimal (#1258)
* Fix: fields with type `Option<T>` are always nullable

* Support BigDecimal
2022-12-01 12:53:19 +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
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
Chris Tsang
1225255431 Address comments 2022-09-14 00:28:24 +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
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
Chris Tsang
b74491a476 [issues] [cli] cargo fmt 2022-07-11 23:58:14 +08:00
kyoto7250
23ac958142
include column name in TryGetError::Null (#853)
* include column name in TryGetError::Null

* remove prefix
2022-07-11 23:16: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
Émile Fugulin
d0aeda7bdd
Add time from u64 (#849) 2022-07-08 18:20:28 +08:00
baoyachi. Aka Rust Hairy crabs
beef8211d8
fix compile error,res args add type (#839)
* fix compile error,res add type

* update .gitignore

* fix compile error

* fix compile error
2022-07-05 16:04:11 +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
Billy Chan
ab2f784701
(de)serialize custom JSON types - 2 (#794)
* de(serialize) custom JSON types

* Rename DeriveTryGetableFromJson -> FromJsonQueryResult

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-07-01 01:27:46 +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
9687819a7e
Supports time crate 2022-03-13 18:18:15 +08:00
Billy Chan
8eb095385d Migration (#335)
* Refactor `ConnectionTrait`

* Refactoring

* Build index & foreign key statements

* Fix imports

* Fixup

* Rocket example with migration

* async-std compatible with the tokio 1.0 runtime

* Use reexported dependency

* Compile without selecting any db backend

* Updating sea-orm-cli dep

* sea-orm-cli migrate commands

* cargo fmt

* Test [cli]

* Refactoring

* Clap app name should be "sea-orm-cli"

* Correctly capture MIGRATION_DIR

* Rename README

* Add `sea-orm-cli migrate init` command

* Update README

* Try restructured sea-query dependency (SeaQL/sea-schema#41)

* Set `DATABASE_URL` environment variable
2022-02-05 20:34:54 +08:00
Billy Chan
8145088814 Refactoring
`ColumnDef` with default value

Cargo fmt

Update docs

Fixup

Support `DateTimeLocal`

Update docs

Codegen write db timestamp column as `DateTimeUtc` type

Update dependency

Merge branch 'sea-query/add-new-column-ref' into pr/429

feat: apply alias on `ColumnRef::SchemaTableColumn`
2022-02-01 14:29:03 +08:00
Charles Chege
52f38a10ea Support the use of chrono::DateTime<Utc> in sea-orm
Add documentation for this

Temporarily use a fork to include new Sea-query code

Add tests for DateTimeUtc

Solve Github actions error by add the code to create a table

Assertion accuracy tests

Rectify incorrect format
2022-02-01 14:27:33 +08:00
Chris Tsang
47cbf50c3c
Merge branch 'master' into pulls/361 2021-12-25 17:41:29 +08:00
Billy Chan
b9fe878542 Handling MySQL & SQLite timestamp columns 2021-12-11 14:25:45 +08:00
Billy Chan
af1ffdad83
Rename sea-strum lib back to strum 2021-12-07 17:21:03 +08:00
Billy Chan
1229287fd8
Support Up to 6 Values Composite Primary Key (#353)
* Support up to 6 composite primary key

* Test [issues]

* Test [issues]
2021-12-04 20:57:05 +08:00
Jaebum Lee
bc952b3787 Add TryFromU64 trait for DateTime<FixedOffset>.
The timestamp column (with time zone) generates the field with `chrono::DateTime<chrono::FixedOffset>`.
Sadly, `DeriveEntityModel` macro fails because `TryFromU64` is not implemented for this type.

I added the trivial implementation for `chrono::DateTime<chrono::FixedOffset>`.
2021-11-21 23:36:13 -08:00
Billy Chan
4c147a2d24
Rewrite doctests 2021-11-16 16:27:54 +08:00
Billy Chan
892c0fe57d
Support Vec<u8> primary key 2021-11-02 15:20:27 +08:00
Charles Chege
817e9bdd23 Documetation for the executor module 2021-10-29 10:38:55 +03:00
Chris Tsang
4fd5d56dbf cargo +nightly fmt 2021-10-04 13:13:36 +08:00
Chris Tsang
af93ea44ad Fix clippy warnings 2021-10-04 12:11:19 +08:00
Chris Tsang
a6dfb417e2
Merge pull request #207 from SeaQL/naive-date
Support `chrono::NaiveDate` & `chrono::NaiveTime`
2021-09-30 22:52:31 +08:00
Chris Tsang
ca296bc941 Feature guard macros 2021-09-30 22:25:31 +08:00
Chris Tsang
fcd969e57c Use DeriveIden to replace ToString 2021-09-30 22:05:23 +08:00
Billy Chan
02066cef6e
Support chrono::NaiveTime 2021-09-30 10:34:38 +08:00
Billy Chan
f7e96b3d72
Support chrono::NaiveDate 2021-09-30 10:34:38 +08:00
Muhannad Alrusayni
5379a23630 Add find_by_statement for T: TryGetableMany
Add `into_values` for `Select<T>`
2021-09-28 00:10:13 +03:00
Muhannad Alrusayni
7742eb2cec Impl TryGetableMany for (T) 2021-09-27 12:47:14 +03:00
Muhannad Alrusayni
15db5d2933 clean up some comments 2021-09-17 22:45:05 +03:00
Muhannad Alrusayni
3bf26a758a impl TryFromU64 for tuples types 2021-09-17 22:41:49 +03:00
Muhannad Alrusayni
56dd19ef75 Impl TryGetableMany for diffrent types of generices 2021-09-17 21:59:38 +03:00
Chris Tsang
182c96e384 Fix clippy warning 2021-09-11 15:53:34 +08:00