242 Commits

Author SHA1 Message Date
Wyatt Herkamp
0adcd3b36c
Update Strum (#2088)
* Update Strum

* Change log update

* Fetch updates from upstream Strum

* build-tools/update-strum-macros.sh

* Revert "Fetch updates from upstream Strum"

This reverts commit 32cf8f7ac96f9b0431d2bde682b69ec44b4f5b2e.

* Update enum_iter.rs

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2024-02-06 18:33:20 +08:00
Billy Chan
42553b6624
1.0.0-rc.1 2024-02-06 14:14:09 +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
Chris Tsang
59e987453d fmt 2024-01-27 19:43:04 +00:00
Chris Tsang
8e6316c90e fmt 2024-01-27 19:32:39 +00:00
Chris Tsang
3c07c91d54 Doc #2083 2024-01-27 19:31:43 +00:00
Chris Tsang
70d4278598 0.12.12 2024-01-22 09:48:29 +00:00
Chris Tsang
260b8a4076 0.12.11 2024-01-14 16:10:33 +00:00
bobogei81123
13d383e43c
fix: fully qualify types in DeriveValueType macro (#2054)
`DeriveValueType` proc macro relies on several sea-orm types to be
imported. This is partially fixed in #1855 by fully qualifying
`sea_orm::QueryResult`, but others like `sea_orm::Value` is still not
being qualified. Also, if use defined a type alias on
`std::result::Result`, it can cause the proc macro to generate code that
won't compile.

- Fully qualify `sea_orm::Value`, `std::string::String`, and
  `std::result::Result` in `DeriveValueType` proc macro.
- Add some simple integration tests for this.
- Add doc and doc test in `sea_orm_macro::derive_value_type`.
2024-01-14 23:06:40 +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
4a59ca681b 0.12.10 2023-12-14 19:42:32 +00: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
Chris Tsang
1ce3778c61 0.12.6 2023-11-13 09:03:26 +00: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
0cffeb62a0 sea-orm-macros 0.12.5 2023-11-05 12:47:14 +00:00
Chris Tsang
42babea318 Hotfix: conditionally impl impl_try_getable_array 2023-10-23 10:08:32 +01:00
Chris Tsang
240620176c 0.12.4 2023-10-19 19:28:46 +01:00
Chris Tsang
93623f0d02 Support MySQL / SQLite 2023-10-16 09:55:30 +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
Chris Tsang
f9db14c686 0.12.3 2023-09-22 18:13:25 +01:00
Chris Tsang
4804170208 Fix DeriveValueType by qualifying QueryResult #1855 2023-09-12 19:40:55 +01:00
Chris Tsang
242237aa51 0.12.2 2023-08-04 20:44:05 +01:00
Chris Tsang
1e6b10b532 0.12.1 2023-07-27 15:01:42 +01:00
Chris Tsang
97ee0a9703 Test derive FromJsonQueryResult 2023-07-26 20:17:55 +01:00
Chris Tsang
96087291c2 0.12.0-rc.5 2023-07-25 16:28:35 +08: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
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
darkmmon
19e761e73d
moving bae2 into sea-orm local system (#1739)
* imported bae2 into sea-orm local system

* doc update

* fix doc

* Remove sea-bae from the workspace

* Use sea-bae

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-07-10 16:11: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
Chris Tsang
4e8d0b0c0c 0.12.0-rc.4 2023-07-08 00:14:02 +08:00
Billy Chan
325e73468e
fmt 2023-07-05 13:03:46 +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
Chris Tsang
b45534c8c2 0.12.0-rc.3 2023-06-22 07:00:42 +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
Chris Tsang
28a5de09d6
Merge pull request #1615 from SeaQL/pulls/1597
Pulls/1597
2023-04-26 18:33:54 +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
b2d78d43da
FromQueryResult proc_macro no longer add TryGetable trait bound to generic types (#1603)
* `FromQueryResult` proc_macro no longer add `TryGetable` trait bound to generic types

* clippy
2023-04-24 11:34:35 +08:00
Billy Chan
fbb16c73fa
Relation join on AND / OR condition (#1433) 2023-04-13 11:48:01 +08:00
Iskandarov Lev
6ae515961c
implemented (#1464) 2023-04-11 11:23:14 +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
5ba9aba900
chore: enable required syn features (#1556) 2023-03-20 18:44:51 +08:00
Billy Chan
8afc3eb2a3
Prepare 0.12.0 2023-03-16 18:28:03 +08:00
Billy Chan
15ff8ab974
fmt 2023-03-16 14:14:19 +08:00