32 Commits

Author SHA1 Message Date
799189288
bead32a0d8
fix: use fully qualified syntax when call fn name in trait ActiveEnum. (#2460) 2024-12-26 19:33:51 +08:00
Billy Chan
7b1495d168
Upstream Pro - 1 (#2415)
* Added `ColumnTrait::enum_type_name()` to signify enum types

* dep

* Added `DbBackend::boolean_value()` for database dependent boolean value

* Bump sea-query

* fmt
2024-12-02 14:33:21 +08:00
Chris Tsang
562778f61d One last refactor 2024-05-29 01:01:12 +01:00
Chris Tsang
e3f64b1892 Refactor 2024-05-29 01:00:14 +01:00
Chris Tsang
461aa925f6 Fix bug and update changelog 2024-05-29 00:53:09 +01:00
Chris Tsang
3e45ac42a2 Revert case_style.rs 2024-05-28 20:18:25 +01:00
Anshul Sanghi
33230ab3ad
Auto Generated ActiveEnum String Values And Model Column Names (#2170)
* WIP: Add Basic Support For Providing String Value For ActiveEnum Variants Based On Renaming Rules #2160

* WIP: Use Existing Case Style Handlers For Enum Rename Rules, Add Unit Tests For DeriveActiveEnum rename rules #2160

* WIP: Improve Implementation Of Name Case Parameters In ActiveEnum Macros #2160

* WIP: Implement Case Styles Based Name Generation For Columns In A Model #2160

* Fix Formatting #2160

* Rename Column Name And Enum Variant Renaming Macro Attributes #2160

* Revert Adding `Rename` Attribute For Column Names #2160

* Revert Unintended Formatting Changes #2160

* Fix formatting

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2024-05-28 20:02:41 +01:00
Chris Tsang
42babea318 Hotfix: conditionally impl impl_try_getable_array 2023-10-23 10:08:32 +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
Chris Tsang
b2cb51380a Introduce TryGetableArray 2023-10-04 03:52:40 +01: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
64342b105c
Upgrading to syn v2 (#1713)
* resetted and re-did the changes

* fmt

* upgraded to syn2 for sea-orm-codegen

* Rename `bae2`

* Drop the use of `#[sea_orm(table_name = "col_name")]` in `DeriveColumn`

* unified derived input metadata parsing filter

* Propagate errors

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-06-26 20:15:37 +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
Sergei Ivankov
c34b6feb5e
Update heck dependency (#1520)
* Update heck dependency

* Fix formatter error

---------

Co-authored-by: Sergei Ivankov <sergeiivankov@pm.me>
2023-03-16 14:13:56 +08:00
Billy Chan
4f8ad56cc4
Cont. Added support for using sea-orm with #[deny(missing_docs)] (#1531)
* Added support for using sea-orm with #[deny(missing_docs)] (#1522)

* feat(macros): Added documentation tags for generated entities

* chore: Added deny(missing_docs) attribute to basic example

* chore: Fix clippy errors

* ci: test missing docs of derive macros generated types

* Try missing docs (CI should fail)

* Revert "Try missing docs (CI should fail)"

This reverts commit 83356bfca8939e7807f14bad8bb816fcabc1bf7b.

---------

Co-authored-by: Lewin Probst, M.Sc <30552361+emirror-de@users.noreply.github.com>
2023-03-10 21:49:08 +08:00
Chris Tsang
a8e37aa65e Fix DeriveActiveEnum #1478 2023-02-18 12:48:24 +08:00
Chris Tsang
5c93253877 Tests 2023-01-09 14:46:19 +08:00
Billy Chan
70c4a3a23e
Select into tuple 2022-12-15 21:24:10 +08:00
Billy Chan
4d8645ae8b
Support Vector of enum for Postgres (#1210)
* Support Vector of enum for Postgres

* Fix clippy

* Add tests for integer array

* Fix dependency

* Bump sea-query to 0.27.2

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-11-15 13:50:05 +08:00
Billy Chan
1be6673f0e
Fix DeriveActiveEnum expand enum variant starts with number (#1219) 2022-11-15 10:56:25 +08:00
Billy Chan
1497c2c7f0
Fix DeriveActiveEnum requires additional imports (#1154)
* fix: Support deriving ActiveEnum without importing EnumIter, Iden, and ActiveEnum

* style: Fix format

* DeriveActiveEnum without depending on sea_query::Iden derive macros

* [issues] add tests

* Fix [issues] features

Co-authored-by: Naoki Ikeguchi <me@s6n.jp>
2022-10-27 00:17:46 +08:00
Billy Chan
b91ca2b778
Implements fmt::Display for ActiveEnum (#986)
Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-10-23 22:29:31 +08:00
Billy Chan
671d79469a
Fixup 2022-10-17 17:25:35 +08:00
Billy Chan
77bddd85a5
Fixup 2022-09-22 15:07:37 +08:00
Mateusz
087f8462a6
Parse enum from repr[X] enums with values (#769)
* parse enum from repr[X] enums with values

* fix parsing negative enums variants with repr[X]

* add tests for enum num_value fallback support
2022-07-02 14:31:16 +08:00
Billy Chan
5a2ccf5a29 Fully quantity std::result::Result in proc_maros 2022-02-01 15:04:58 +02:00
Billy Chan
f64f1e9216
DeriveActiveEnum generate code that depends on sea-query inside sea-orm 2021-11-04 11:01:29 +08:00
Billy Chan
bb78a1d709
More ergonomic DeriveActiveEnum derive macro 2021-11-03 15:38:42 +08:00
Billy Chan
f1ef7d9c47
Add DbErr::Type 2021-10-20 16:41:01 +08:00
Billy Chan
bf1663506a
Fix clippy warnings 2021-10-20 12:25:26 +08:00
Billy Chan
30e17a26d9
Better error messages 2021-10-20 12:17:10 +08:00
Billy Chan
8627c8d961
Draft ActiveEnum 2021-10-19 19:08:02 +08:00