958 Commits

Author SHA1 Message Date
Chris Tsang
33fc350e76 Readme 2023-07-30 06:00:14 +08:00
Chris Tsang
c5529b33f9 Readme 2023-07-27 14:29:38 +01:00
Chris Tsang
ae8dcceb43 Community Survey 2023-07-27 19:11:17 +08:00
Chris Tsang
8064097639 Comment 2023-07-26 19:03:56 +01:00
Chris Tsang
ad33d7745d Readme 2023-07-26 19:07:36 +08:00
Chris Tsang
2ce41fa6f2 Readme 2023-07-26 18:59:16 +08:00
Billy Chan
9b54797dd7
Upgrade SQLx to v0.7 (#1742)
* Upgrade SQLx to v0.7

* Refactoring

* Fixup

* Bump SeaSchema version

* Fixup

* Refactoring

* Refactoring

* dep

* Bump

* Update sea-schema

* Update sea-schema

---------

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-07-22 01:56:48 +08:00
Chris Tsang
a5f2ae69e9 Organize entity prelude 2023-07-13 16:53:24 +01:00
Chris Tsang
e8b1c0b975 Docs 2023-07-13 16:39:41 +01:00
Chris Tsang
d920fc3eda Changelog 2023-07-13 16:33:03 +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
500e761a68 Changelog 2023-07-13 16:00:37 +01:00
Chris Tsang
3629b91d01 Do not deprecate default_value 2023-07-13 15:16:55 +01:00
Diwakar Gupta
1ba37b61d5
Add default_expr support for ColumnDef (#1474)
* Add default_expr support for ColumnDef

* added test for attribute `default_value`

* Implements `PartialEq` for `sea_query::SimpleExpr`

* RcOrArc

* Re-export `sea_query::Expr` in `sea_orm::entity::prelude`

* Add default_expr support for ColumnDef

* added test for attribute `default_value`

* Implements `PartialEq` for `sea_query::SimpleExpr`

* RcOrArc

* Re-export `sea_query::Expr` in `sea_orm::entity::prelude`

* Deprecate `ColumnDef::default_value()`

* Add `ColumnDef::default()`

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-07-13 22:09:53 +08:00
Chris Tsang
ae899d6744 Remove sea-query's Iden macro 2023-07-13 10:36:56 +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
727d83c9d7 Docs 2023-07-10 21:55:26 +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
Billy Chan
207c008e5b
Unused import 2023-07-08 08:23:05 +08:00
Chris Tsang
6dc19d97bd Support tuple primary key (as the old impl does)
Also, r_model is optional (same as the old impl)
2023-07-07 23:16:10 +08:00
darkmmon
50a7048deb Adding find_with_linked (#1728) 2023-07-07 22:19:45 +08:00
Billy Chan
acca634e03
Revert "Upgrade SQLx to v0.7"
This reverts commit 832fabf8ff296896231c0d00bc42ecde779c6d5f.
2023-07-07 16:31:15 +08:00
Billy Chan
832fabf8ff
Upgrade SQLx to v0.7 2023-07-07 16:30:21 +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
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
darkmmon
b37e7655f8
Added enum for SQLx Error and basic functions for it (#1707)
* Added enum for SQL Error and basic functions for it

* fmt

* Restructured code to allow multiple database system simultaneously

* updated code error and moved Eq to derive by compiler

* added ForeignKeyViolation implementation

* fmt

* added type param

* changed type param and used unwrap_or_default instead of unwrap

* fmt

* refactor code and update documentation

* updated some error code and fixed formatting

* create SQL Err test for UniqueConstraintViolation

* fmt

* updated error codes for mysql errors

* added test for ForeignKeyConstraintViolation and removed unused imports/codes

* fmt

* updated doc and error message

* added static str in SqlErr

* changed to add error message into SqlErr as String

* updated test file to check database type through connection

* fmt

* updated test for SqlErr to match the error type only

* Removed comment and fixed grammar mistake

* fmt

* Update src/error.rs

* Refactoring

---------

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-06-19 17:19:08 +08:00
darkmmon
0816faa7f1
#1696 fix (#1702)
* Test suit load environment variable from env files

* Added expr() and exprs() for QuerySelect trait and Minor typo fix

* fmt

* Added doc testing for the new functions

* Remove excess comment for doc test

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>

* Remove excess comment for doc test

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>

* updated doc tests to make example more realistic

* changed doc test again for more realistic query and added expr_as()

* aligned expr_as() alias input with column_as() input

* update doc test for expr_as() according to previous changes

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-06-13 21:01:15 +08:00
Alvaro Parker
adc467f228
Fix a small typo (#1685) 2023-06-06 17:38:12 +08:00
Clément Guiton
3ccb9cdbf7
Feat: Expose ping method from SQLx (#1627)
* feat: add connection.ping method

* fmt

* impl `ConnectionTrait::ping` method for `SchemaManagerConnection`

* Mock connection should always be online

* remove needless clippy lint

* fmt

* Remove needless instrument

* Update src/driver/sqlx_sqlite.rs

* <feat>(Ping) removed ping() from ConnectionTrait

* removed ping from transaction

* removed unused imports

* Revert

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-06-01 18:21:38 +08:00
Billy Chan
33f3f9282d
feat: implement ColumnTypeTrait for ColumnDef (#1576) 2023-05-29 20:35:02 +08:00
Panagiotis Karatakis
3300336b1a
Expand SeaORM entity generator with Seaography related data (#1599)
* Add DeriveRelatedEntity macro

* Add generation for related enum and seaography

* Add seaography cli param

* update codegen tests

* Fix DeriveRelatedEntity macro doc and includes

* Fix all RelatedEntity variants for RelationBuilder

* Add tests for code

* Cargo format

* Fix clippy code

* Fix format

* Fix unit tests

* Fix unit tests

* Provide default for seaography::RelationBuilder

* Update changelog

* Update tests

* Modify code to match feedback
* Bring old Related Impl trait generation
* Modify DeriveRelatedEntity to gen impl seaography::RelationBuilder
* Generate RelatedEntity enum when seaography flag is enabled

* Update documentation

* Update Changelog

* Fix format errors

* Fix code generation
* relations with suffix are definition based
* Rev => Reverse easier to read
* snake_case to cameCase for name generation

* Fix unit tests

* Update lib.rs

* derive `seaography::RelationBuilder` only when `seaography` feature is enabled

* Try constructing async-graphql root for "related entity" and "entity" without relation

* Update demo

* CHANGELOG

* Update Cargo.toml

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>

* Revert "Update Cargo.toml"

This reverts commit 6b1669836a4fb5040bfb08999f0cf640c74dc64d.

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2023-05-19 22:14:46 +08:00
Billy Chan
44a94d65d2
Bump SeaQuery and SeaSchema to new latest RC version (#1661) 2023-05-18 16:51:13 +08:00
Chris Tsang
a6646cdd2d cargo fmt 2023-04-26 21:42:18 +08:00
Chris Tsang
9e5900e25b cargo fmt 2023-04-26 21:41:45 +08:00
Chris Tsang
2746271190 Changelog 2023-04-26 21:32:16 +08:00
Billy Chan
e6b6629733 Revert SeaORM prelude
Add `stream_partial_model` to `Select<E>` and `SelectTwo<E,F>`

Minor refactoring

fmt

Add `into_partial_model` to `Cursor<S>`

refactoring

Add test cases

Fix test cases

More test cases

Move partial_model tests
2023-04-26 18:28:53 +08:00
ForzenString
744e063222 add SelectColumns only modify select columns
add `PartialModelTrait` for a part of model

re-export `PartialModelTrait`

cargo fmt

add fn`into_partial_model` on `Select`&`SelectTwo`

add `DerivePartialModel` to impl `PartialModel`

add macro `DerivePartialModel` to `sea-orm`

disambiguate `SelectColumns` function

fix macro error

cargo fmt && cargo clippy

move `SelectColumns` from helper.rs to traits.rs

cargo fmt

Reduce nest hell of load attribute argument fetch

 test `DerivePartialModel`  input parse

`DerivePartialModel` not derive with generic

fix `DerivePartialModel` code generate error

remove unused use

cargo fmt

add `into_partial_model` for `SelectTwoMany`
2023-04-26 18:28:44 +08:00
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