868 Commits

Author SHA1 Message Date
Billy Chan
d45bb5b304
Support composite primary key of length up to 12 (#1508)
* feat: support composite primary key of length up to 12

* induction proof

* docs

* revert tests

* testing cursor by 4+ columns
2023-04-13 16:18:47 +08:00
Billy Chan
fbb16c73fa
Relation join on AND / OR condition (#1433) 2023-04-13 11:48:01 +08:00
Billy Chan
6833529441
feat: String parameters accept any Into<String> (#1439) 2023-04-11 12:51:51 +08:00
Chris Tsang
1de34b516b Docs 2023-03-25 15:11:22 +08:00
Denny Wong
5ef273d5e4
Added escaping to ActiveEnum to allow for non-UAX#31 chars, as well as camel_case related conflicts. (#1374)
* Added escaping to ActiveEnum to allow for non-Unicode Standard Annex #31 characters, as well as addressing issues with ' ' and '_' causing potential identifier conflicts.

* Improved docstring for camel_case_with_escaped_non_xid.

* Moved underscore prepending to camel_case_with_escaped_non_xid.

* cargo fmt and code fixes to resolve CI failures.

* Added unittest to sea_orm_macros::util for new function.

* Fixed a typo in a doc code block.

* clippy

* Test cases

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-03-23 12:41:05 +08:00
Billy Chan
737a894e27
Upgrade sea-query to 0.29 (#1562)
* Upgrade `sea-query` to 0.29

* clippy

* More upgrades

* fixup
2023-03-22 17:24:42 +08:00
Billy Chan
2eda8aa3f2
Drop the use of sea-strum and depends on the original strum with a tailored EnumIter provided (#1535)
* Update heck dependency

* Fix formatter error

* Drop the use of `sea-strum` and depends on the original `strum` with a tailored `EnumIter` provided

* fmt

* Depends on `strum` 0.23

* Depends on `strum` 0.24

* Source code adapted from https://github.com/Peternator7/strum

* Update LICENSE

---------

Co-authored-by: Sergei Ivankov <sergeiivankov@pm.me>
Co-authored-by: Sergei Ivankov <96142843+sergeiivankov@users.noreply.github.com>
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-03-22 11:47:15 +08:00
Billy Chan
f646aa7a70
chore: re-export sea_query::BlobSize in sea_orm::entity::prelude (#1548) 2023-03-20 18:52:26 +08:00
Reverier
1161bc0f4a
set unselected Column of type Option<T> to None (#1513)
* Support `None` value for unselected Optional columns, closes #1507

* Support `None` value for unselected Optional columns, closes #1507

* fix rustfmt and cfg control issues

* add test case for #1513
2023-03-16 21:24:58 +08:00
Chris Tsang
d673f16ed7 Clarify behavior #1138 2023-03-10 23:52:10 +08:00
Billy Chan
2407597870
clippy 2023-02-23 20:34:28 +08:00
Chris Tsang
f03a1761ac Docs #1491 2023-02-23 14:34:46 +08:00
Billy Chan
e1297850ac
Docs 2023-02-08 15:15:57 +08:00
Chris Tsang
97da42df15 docs.rs for mock #1453 2023-02-05 19:40:47 +08:00
Billy Chan
8680c46177
Refactor select_as & save_as implementation generated by derive macros (#1442) 2023-02-04 15:53:10 +08:00
Chris Tsang
d07f840830 Improve example 2023-02-03 13:57:12 +08:00
Chris Tsang
56e4b4337b Improve API & Example 2023-02-02 11:21:00 +08:00
Chris Tsang
83c0732395 load_many_to_many 2023-02-02 09:38:30 +08:00
Chris Tsang
0670827148 Improve test cases 2023-02-02 07:46:38 +08:00
Billy Chan
91c4930391
Cleanup panic and unwrap (#1231)
* Add clippy linter checks

* Mock

* InnerConnection

* panic -> Err

* panic -> Err

* More panic -> Err

* Replace unwrap

* Fix clippy

* add clippy linters

* Refactor

* Dump DbErr::Mock

* Revert if...else rewrite

* Remove except

* DbErr helper functions

* Fix clippy

* Negative SQLite last_insert_rowid throw unreachable

* Update panics docs

* Fixup

* Fixup

* Fixup

* Fixup

* Revert adding `ExecResultHolder::Disconnected`

* More fixup

* Fix

* Revert adding `QueryResultRow::Disconnected`

* Fix

* Refactoring

* Fix

* Refactoring

* More refactoring

* More refactoring

* Fix

* Revert `InnerConnection::Disconnected`

* Revert breaking changes

* Fix

* Fix

* Fix

* Refactor `.take().expect()`

* Revert changing `if ... else` to `match` block

* Revert changing return type of `MockDatabaseConnection` transaction method

* Borrow sqlcipher_key

* Fetching unsupported type from query result will thrown `DbErr::Type(...)` error

* Revert adding `DatabaseConnection::try_into_transaction_log()` method

* Refactoring

* Refactoring
2023-02-02 00:02:53 +08:00
Billy Chan
b21abf617f
Fix clippy warnings (#1437) 2023-01-31 16:46:44 +08:00
Billy Chan
e2721e094a
Cont. added reexports for sqlx errors (#1434)
* added reexports for sqlx errors (#1181)

Co-authored-by: erhodes <erik@space-nav.com>

* Re-export SQLx error types

* Apply suggestions from code review

---------

Co-authored-by: e-rhodes <33500135+e-rhodes@users.noreply.github.com>
Co-authored-by: erhodes <erik@space-nav.com>
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-01-31 13:03:57 +08:00
Billy Chan
a6bd91a78b
Use ActiveEnum field as composite primary key (#1414)
* Use ActiveEnum field as part of composite primary key

* Try unique constraint failed
2023-01-30 21:47:49 +08:00
Billy Chan
1e9eb0f46e
Imports cleanup 2023-01-30 12:41:12 +08:00
Billy Chan
51e6ad7170
Cast primary key column inside returning expression of insert statement (#1427) 2023-01-29 12:58:32 +08:00
Chris Tsang
5ffd8025f2 Update prelude 2023-01-29 11:34:28 +08:00
Billy Chan
08a5e87e22
Replace SeaORM's ColumnType (#1395)
* Replace SeaORM's `ColumnType`

* Bump SeaQuery's version

* Fix merge conflict

* refactor
2023-01-29 11:06:01 +08:00
Billy Chan
71dbffc725
Fix clippy (#1426)
* Fix clippy

* Fix clippy
2023-01-27 18:50:20 +08:00
Chris Tsang
5683c83189 Changelog & Docs 2023-01-26 23:36:16 +08:00
Billy Chan
4e1a0e4a7c
Allows offset & limit to take Option<u64> (#1410)
* Allows offset & limit to take `Option<u64>`

* Takes `Into<Option<u64>>` instead

* Reset limit and offset when None value is provided
2023-01-27 13:03:13 +08:00
Chris Tsang
37704e1ed8
Merge pull request #1425 from SeaQL/record_not_updated
RecordNotFound -> RecordNotUpdated
2023-01-26 18:41:11 +08:00
Billy Chan
1c43508b66
QueryTrait::maybe: a general purpose query customizer (#1415)
* Added `QueryTrait::maybe`

* Make the API better

* Docs

* Update src/query/traits.rs

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-01-26 17:48:25 +08:00
Chris Tsang
b3e4d1c1cf RecordNotFound -> RecordNotUpdated 2023-01-25 15:43:44 +08:00
Billy Chan
036edf9d70
Noop when update without providing any values (#1384)
* Noop when update without providing any values

* Add tests

* Update Cargo.toml

* Bump SeaQuery's version

* Fixup

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-01-26 17:12:50 +08:00
Chris Tsang
03207fbda9 Use rows_affected when DB does not support returning 2023-01-18 21:18:04 +08:00
Chris Tsang
a465d1ebac Refactor 2 2023-01-18 20:46:02 +08:00
Chris Tsang
07d5f781ca Refactor 2023-01-18 20:08:10 +08:00
Chris Tsang
e5b69ebb73 Don't call last_insert_id if not needed 2023-01-18 19:06:06 +08:00
LeoniePhiline
f03424e7f7
fix(docs): Fix a small typo (#1391) 2023-01-18 18:45:35 +08:00
Billy Chan
e2b796b093
Cont. feat: expose database connection to ActiveModelBehaviour's methods (#1328)
* feat: expose database connection to `ActiveModelBehaviour`'s methods (#1145)

* Make ActiveModelTrait async

* Add tests

* refactoring

Co-authored-by: teenjuna <53595243+teenjuna@users.noreply.github.com>
2023-01-12 17:22:46 +08:00
Billy Chan
cb71e265df
Unchanged ActiveValue as Set (#1177)
* Unchanged ActiveValue as Set

* Renaming

* Rename

* Rename methods
2023-01-12 15:42:13 +08:00
Chris Tsang
395203bd06 Docs 2023-01-12 14:09:26 +08:00
Billy Chan
e9df3aa01d
Casting columns as a different data type on select, insert and update (#1304)
* Cast select and value

* Refactoring

* Test casting Postgres citext

* Fixup

* Revert

* Add test cases

* Fixup

* Rename methods
2023-01-12 14:56:11 +08:00
Chris Tsang
bb5dead0c8 Docs 2023-01-12 13:55:39 +08:00
Chris Tsang
0787035a42 Docs 2023-01-12 13:51:43 +08:00
Billy Chan
a0d972633a
Implement LoaderTrait for slices (#1368) 2023-01-11 19:12:45 +08:00
Billy Chan
0756adf647
find_by_id and delete_by_id take any Into primary key value (#1362) 2023-01-11 15:28:10 +08:00
Billy Chan
c49a8ac843
Fix merge conflict (#1386)
* Fix merge conflict

* remove unnecessary clone
2023-01-11 15:27:34 +08:00
Billy Chan
cbd7a8d1c9
Cleanup the use of vec![] (#1367)
* Public methods accept any IntoIterator as argument

* refactoring
2023-01-11 14:17:06 +08:00
Billy Chan
b5e984ca4a
Postgres insert many will throw RecordNotInserted error if non of them are being inserted (#1021) 2023-01-11 14:16:35 +08:00