376 Commits

Author SHA1 Message Date
Jonas Platte
ead131d937
Use input ident instead of associated type projections in ActiveModel derive (#2349)
* Use input ident instead of associated type projections in ActiveModel derive

* Add a test
2024-10-25 11:04:35 +01:00
Alvaro Parker
bfd21e92e3
Fix typos (#2360)
* fix typos

* CHANGELOG

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2024-10-04 16:42:52 +08:00
Billy Chan
563562d325
Bump SQLx to 0.8 (#2305)
* Bump SQLx to 0.8

* Bump bigdecimal to 0.4

* Bump sea-query

* Bump sea-schema

* Fix clippy warnings

* Patch for examples

* Fix: enable serde feature on dependent crates

* `TryGetable` for MySQL String

* Fix pi_tests

* Fix uuid_tests

* Handle MySQL into_json

* examples CI

* Fix

* Drop Git override

* Bump to RC version

* revert
2024-08-09 18:32:14 +08:00
Billy Chan
b4506c0647
MySQL insert on conflict do nothing (#2244)
* MySQL insert on conflict do nothing

* on_conflict_do_nothing

* clippy
2024-06-19 20:09:30 +08:00
Billy Chan
aa626fc1fd
clippy 2024-05-06 13:53:41 +08:00
Hayashi Mikihiro
a069d46aff
add #![cfg(any(feature ...))], to reduce warning in cargo test (#2177) 2024-04-17 23:49:00 +01:00
Billy Chan
0ff000b8f8
Upstream Changes - 4 (#2168)
* cli: generate entity ignore default database schema

* fixup

* select result is `i32`

* fix

* clippy

* revert

* revert

* revert

* revert
2024-03-27 16:19:03 +08:00
Billy Chan
950a3bc201
Upstream Changes - 2 (#2149)
* Upstream Changes - 2

* revert
2024-03-13 08:51:17 +00:00
凊弦凝绝
a0a7e74ae9
Fix DerivePartialModel attr entity not support syn::Type token (#2137)
* 🐛 fix macro attr `entity` only accept `Ident`

* 🎨 cargo fmt

*  fix test
2024-03-10 18:20:24 +00:00
Billy Chan
f3967fdaca
Upstream Changes - 1 (#2145)
* upstream changes

* universal `#[sea_orm_macros::test]`

* fix

* fix

* `ColumnTrait::into_returning_expr`

* fix

* fix

* Do not pub sqlx_common

---------

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2024-03-10 18:14:46 +00:00
Billy Chan
b775027fee
Explicit StringLen on ColumnType::String (#2123) 2024-03-05 15:31:58 +08:00
Billy Chan
cef380b977
SQLite type mappings (#2077)
* sqlite: deps

* sqlite: update data type mappings

* sqlite: decimal test cases

* sqlite: try negative numbers

* fixup

* fixup

* fmt

* clippy

* fixup

* fixup

* fixup

* refactor

* fix

* Drop the use of `rust_decimal_macros` (#2078)

* sqlite: decimal -> real

* revert

* Bump dependencies

* Fixup

* Fixup

* Fixup

* Fixup

* Refactor

* Refactor

* Refactor
2024-02-05 14:42:55 +08:00
Andrea Corradi
c56c072f27
Enable sqlite returning with feature flag (#2070)
* Enable sqlite returning with feature flag

* Add runtime check for sqlite version

* Apply suggestions from code review

* Fix clippy

* Rename feature

* Fix tests when feature flag is not enabled

---------

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2024-01-26 04:28:59 +08:00
Billy Chan
9797da1ee4
Drop the use of rust_decimal_macros (#2078) 2024-01-24 17:58:50 +08:00
Maksim Zaborovskiy
c5adb9d1d1
Add cursor pagination desc order (#2037)
* feat: add cursor pagination desc order

* feat: add cursor pagination desc order

* test: add cursor integration tests

* test: add cursor integration tests

* test: add query cursor_by tests

* test: add query cursor_by tests

* test: add query cursor_by tests

* test: add query cursor_by tests

* test: add query cursor_by tests

* test: add query cursor_by sort tests

* chore: remove unused import
2024-01-14 23:23:55 +08:00
Dmitrii Aleksandrov
a73f699578
Cast enums in lt(), lte(), gt(), gte() (#2014)
* Cast enums in lt, lte, gt, gte (revert 10f3de0, discussed under #1527)

* Add tests for enum order comparisons
2024-01-12 22:42:29 +08:00
Chris Tsang
f54683d365
Refactor/fix clippy errors (#2056) (#2057)
* chore: add clippy config file

* refactor: fix clippy errors and wornings of runtime-async-std-native-tls,sqlx-all

* refactor: fix clippy errors and wornings of sqlx-sqlite, sqlx-mysql, sqlx-postgres

* chore: format

* refactor: fix clippy

* fix: import path

* refactor: fix clippy errors and wornings of sqlx-sqlite, sqlx-mysql, sqlx-postgres

* fix: revert some space and comma removal

* fix: revert some space and comma removal

* refactor: add feature flag

* fix: import path

* test: remove mismatch feature flag

* test: remove mismatch feature flag

* chore: add proper feature flag

* chore: remove feature flag

* refactor: remove clippy.toml file

* fix: re-export driver

* fix: re-export JoinType

* fix: remove feature flag

* chore: add #[allow(unused_imports)] for driver

Co-authored-by: Shogo Nakano <61229807+shogo-nakano-desu@users.noreply.github.com>
2024-01-11 00:21:22 +08:00
Chris Tsang
1554db5000 Fixup 2023-12-14 20:21:11 +00:00
Chris Tsang
e10dcd012f Revert "Fixup"
This reverts commit 8a29cba78a45fc6c7fa578dfb0163ec44a77de98.
2023-12-14 20:20:25 +00:00
Chris Tsang
8a29cba78a Fixup 2023-12-14 20:03:02 +00:00
Chris Tsang
b8ad6303d8 Fixup 2023-12-14 19:47:52 +00:00
Dmitrii Aleksandrov
1abc47b5f1
Cast enums in is_in and is_not_in (#1527) (#2002)
* Cast enums in `is_in` and `is_not_in` (#1527)

* Restore original tests, add tests for generated SQL
2023-12-15 03:41:05 +08:00
94eac96513
create_table_from_entity support comment (#2009)
* support table and column comment

* create_table_from_entity support comment

* fmt code

* fmt code

* add comment test

* fix test
2023-12-14 18:22:36 +08:00
Wyatt Herkamp
b4010ecb64
Add #[sea_orm(skip)] for FromQueryResult macro (#1954)
* Add #[sea_orm(skip)] for FromQueryResult macro

* Update sea-orm-rocket

* Revert "Update sea-orm-rocket"

This reverts commit b7226bb44dbdbab9782524feb0303c4c166d3050.
2023-11-08 23:45:38 +08:00
Chris Tsang
77ae46f85f
Merge pull request #1898 from SeaQL/rework-active-enum
Rework ActiveEnum to support TryGetable for Vec<Json>
2023-10-16 10:05:08 +01:00
Chris Tsang
93623f0d02 Support MySQL / SQLite 2023-10-16 09:55:30 +01:00
Chris Tsang
d29ed5b9bb Avoid repeating this 100 times 2023-10-12 13:52:05 +01:00
Anshul Sanghi
201d6fe9f9
Add Tests And Fix Build Issue For "Rework active enum" PR (#1900)
* Add Tests For Root JSON Arrays And Active Enum Vectors

* Fix Build Issue When Using `DeriveActiveEnum`
2023-10-12 16:23:29 +08:00
Ivan Yiu
27ca745208
SelectTwo cursor by, cursorTrait revamp (#1826)
* WIP

* WIP

* test cases for cursor with SelectTwo

* fmt, fix test

* WIP, missing test for also_linked cursor_by

* completed many_to_many relationship

* test fixup

* fmt

* extra order_by to fix test

* WIP

* fixed cursor_by to do ordering implicitly base on both cursor column and primary key from other table

* change from map to for loop to eagerly do order_by

* fix tests
2023-09-23 00:03:04 +08:00
Billy Chan
f6b94c3a7a
Bump chrono to 0.4.30 (#1858)
* Bump `chrono` to 0.4.30

* Fix test cases
2023-09-13 23:03:57 +08:00
Ivan Yiu
d50312c081
Test cases improvement (#1811)
* adds find_with_linked test

* WIP(related test)

* mock related test done

* complete relation test

* loader update

* find_with/also_related missing test case for empty from other side

* comments fixup

* revert loader test

* related select test done

* find with/also linked test cases

* removed due to it being functionally same as the new one

* fmt, remove excess import

* improved model generation

* issue related test case #1790

* added loader test cases and slight improvement to find_related/linked

* miscellaneous changes

* added empty insert, merge load_one test case

* completed loader many to many test case, fmt

* removed empty_insert test case for now

* commented insert_test

* added Cargo.toml for issue 1790's folder

* buffed salvo version for ci(0.49 yanked)

* revert version for salvo example
2023-08-18 20:02:17 +08:00
Anshul Sanghi
5fa2c1c28c
Add Support For PostgreSQL Arrays In FromQueryResult Implementation Of JsonValue (#1598)
* Add Support For PostgreSQL Arrays In FromQueryResult Implementation Of JsonValue

* Add support for root arrays in JSON in SeaORM #1517

* Refactoring

* Only when `postgres-array` is enabled

* Add test cases

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-08-02 02:42:16 +08:00
Chris Tsang
ec581abf56 Fix test 2023-07-26 21:09:25 +01:00
Chris Tsang
3f81fd5e89 cargo fmt 2023-07-26 20:27:26 +01:00
Chris Tsang
97ee0a9703 Test derive FromJsonQueryResult 2023-07-26 20:17:55 +01:00
Chris Tsang
8064097639 Comment 2023-07-26 19:03:56 +01:00
Chris Tsang
a5f2ae69e9 Organize entity prelude 2023-07-13 16:53:24 +01:00
darkmmon
fd4aab7a8c
Connection acquire expand (#1737)
* Try connection pool acquire timeout

* expanded ConnectionAcquire Errors, and adjusted relevant functions

* updated to include ClosedConnection
removed unknown as variant of ConnectionAcquireError
updated DbErr Eq

* revert mistakenly edited code

* prolonged the timeout time for connection timeout tests

* Revert "prolonged the timeout time for connection timeout tests"

This reverts commit 04d98cf1fdafe64dbe6168b3bbcdcc813329ac4c.

* Error PartialEq & Eq

* fn conn_acquire_err

* refactor code with conn_acquire_err

* fmt

* error msg

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-07-13 23:24:12 +08:00
Chris Tsang
c2d1968627 Reinstate Table => type_name semantic 2023-07-13 11:30:34 +01:00
darkmmon
866025a733
implement DeriveIden in sea-orm only (#1740)
* WIP, implementing Iden

* completed implementation for DeriveIden and added basic test cases

* added feature flag to prevent sea-orm::sea-query::DeriveIden from crashing when sea-query is not used

* fixed doc test and adjusted test case

* enable `sea-query-derive`'s `sea-orm` feature

* Bump `sea-query-derive` to v0.4

* Update Cargo.toml

* Update Cargo.toml

* adjusted test cases and updated so that iden attribute will not be snake cased

* Update Cargo.toml

* Update main.rs

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-07-13 16:28:35 +08:00
Chris Tsang
d7a978642e Do not throw RecordNotUpdated error 2023-07-10 20:17:34 +08:00
Billy Chan
53caf94af9 Update many with returning 2023-07-10 20:16:58 +08:00
darkmmon
902c0ed5ff
DeriveDisplay macro for enum (#1726)
* WIP

* WIP

* WIP

* changed from storing ident to storing TokenStream internally

* Push for code sharing

* fmt

* changing test target to string

* updated Display not showing extra single quote, fixed clippy

* removed DeriveDisplay for test case not using display trait

* added test cases for display_value attribute

* Remove useless clone

* Add comment

* Remove useless clone

* Rename method

* Refactoring

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-07-10 11:51:19 +08:00
darkmmon
f5a7311794
Derive value type (#1720)
* progress (WIP)

* WIP

* WIP, finished structure except impl programming

* WIP

* revert event_trigger modification

* adding tests and mods

* completed derive value type

* fixed tests, adjusted code position and completed error messages

* column type commit

* added attribute array_type and column_type for specification

* renamed items and files, and removed debug messages

* move attributes outside of the wrapper struct

* refactored code for type matching, and restructured code in test cases

* clippy fix

* fix(doc): fix salvo framework name (#1731)

Co-authored-by: 黄景祥 <jingxiang.huang@baishancloud.com>

* fmt

* changed json_vec_test to use DeriveValueType

* fmt

* Revert "changed json_vec_test to use DeriveValueType"

This reverts commit 92bbf3b6e4eca72e0af0af35776aeec3ee035602.

* added test cases for inserting StringVec in a model

* fmt

* Try non-public wrapped type

* Refactoring

---------

Co-authored-by: joelhy <joelhy@gmail.com>
Co-authored-by: 黄景祥 <jingxiang.huang@baishancloud.com>
Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-07-10 10:48:20 +08:00
darkmmon
50a7048deb Adding find_with_linked (#1728) 2023-07-07 22:19:45 +08:00
Chris Tsang
1f3fa1dc19 Changelog with Tweaks 2023-06-21 23:14:57 +08:00
darkmmon
6e7950158a
Do nothing on conflict (#1712)
* added Conflicted to TryInsertResult

clippy changes

fmt

change from basic if statement to matches

* changed to early return
2023-06-21 22:47:17 +08:00
Chris Tsang
f7398d1c5c Fixup 2023-06-20 17:59:58 +08:00
Chris Tsang
5e5aa7cbd1 Changelog 2023-06-20 17:23:05 +08:00
darkmmon
92ea837cdf
Make insert statement not panic when inserting nothing (#1708)
* end-of-day commit (WIP)

* progress commit (WIP)

* refactored and added InsertAttempt

* async asjusting

* completed implementation for insertAttempt in execution
Added in tests for insertAttempt

* updated wording for new INSERT type

* removed InsertTrait
2023-06-20 17:17:18 +08:00