92 Commits

Author SHA1 Message Date
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
fbb16c73fa
Relation join on AND / OR condition (#1433) 2023-04-13 11:48:01 +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
e246d3faaf
Cont. Upgrade to SeaQuery 0.28.0 (#1366)
* Upgrade to SeaQuery 0.28.0

* Remove unnecessary heap allocation

* Upgrade sea-query-binder

* Upgrade sea-schema

* Fix

* Upgrade sea-schema

* refactoring

Co-authored-by: Ivan Krivosheev <py.krivosheev@gmail.com>
2023-01-05 20:41:28 +08:00
Chris Tsang
d80e61ed7e
Add files via upload 2023-01-02 18:26:20 +08:00
Billy Chan
6ba8e1b9f1
DeriveRelation on empty Relation enum (#1019) 2022-09-25 10:17:39 +08:00
Billy Chan
a80c33ef4c
Rewrite enum and text casting (#973)
* Rewrite enum and text casting

* Add doc tests

* Refactoring
2022-09-05 00:38:12 +08:00
Billy Chan
43495de0aa
Fix clippy warnings - 1 (#967)
* Fix clippy warnings

* cargo fmt

* Fix clippy warnings

* cargo fmt
2022-08-12 20:02:53 +08:00
Billy Chan
75cb269ceb
Custom join on conditions (#793)
* Custom join on conditions

* Try lambda approach

* Implement debug for relation

* Add example without `rev`

* Add more examples

* Docs
2022-06-29 00:27:55 +08:00
Chris Tsang
c4f0db334d Fix build error 2022-03-27 00:24:10 +08:00
Billy Chan
6091629adb
cargo fmt 2022-03-25 15:25:49 +08:00
Nick Burrett
a09790ef81
Allow for creation of indexes for PostgeSQL and SQLite (#593)
* Allow for creation of indexes for PostgeSQL and SQLite

PostgreSQL and SQLite do not allow creation of general indexes within a `CREATE TABLE` statement, so a method is required to generate `CREATE INDEX` statements for these.

`create_table_from_entity` avoids creating invalid statements for non-MySQL backends,
forcing uses to explicitly run `create_index_from_entity`.  Ideally creating indexes would be removed from `create_table_from_entity` entirely, but this would introduce a breaking change for MySQL use.

* Remove index creation from create_table_from_entity

Use `create_index_from_entity` for all index creation for consistency across all backends.  This is a backwards incompatible change, affecting those using MySQL backend when creating the schema only.

* Revert change to join_8 test after migration to new indexes entity
2022-03-21 00:45:08 +08:00
Billy Chan
351efd0d6b
Update ActiveModel by JSON (#492)
* Update ActiveModel by JSON

* Add `ActiveModel::from_json`

* Update test cases
2022-03-13 18:41:32 +08:00
Billy Chan
b65d441dea
Fix clippy warnings 2021-10-21 16:26:42 +08:00
Chris Tsang
8ce392ba8c #249 Build with mock + macros 2021-10-15 23:08:55 +08:00
Billy Chan
d6b53abd95
Handle crate, Self and self rust keywords 2021-10-06 22:24:52 +08:00
Billy Chan
7779ac886e
Escape rust keyword on codegen 2021-10-05 10:49:06 +08:00
Billy Chan
f3f24320e9
Add test cases 2021-10-05 10:23:45 +08:00
Billy Chan
19a572b721
Escape rust keywords with r# raw identifier 2021-10-04 23:30:20 +08:00
Billy Chan
54150382b9
Merge branch 'master' into rename-col-name-n-variant 2021-09-30 10:48:43 +08:00
Billy Chan
89806ef522
Add test cases 2021-09-28 14:27:30 +08:00
Billy Chan
e558dc8584
Move impl Linked to entity_linked module 2021-09-27 12:13:57 +08:00
Billy Chan
a4f2e3c2a8
Test cases with more level of joins 2021-09-27 11:45:19 +08:00
Chris Tsang
5509048550
Merge pull request #166 from SeaQL/model-ignore-attribute
Model ignore attributes
2021-09-17 17:20:42 +08:00
Billy Chan
a45c44cfc5 Add cake_expanded entity file for docs demo 2021-09-17 17:20:07 +08:00
Billy Chan
4e7bf8b836
Testing 2021-09-16 13:11:26 +08:00
Billy Chan
54bb358cca
DeriveEntityModel automatically derive DeriveModel and DeriveActiveModel 2021-09-08 22:02:24 +08:00
Chris Tsang
fa02a45fbf Try more DeriveEntityModel 2021-09-07 23:00:16 +08:00
Chris Tsang
a186338ff5 Try DeriveRelation 2021-09-07 22:54:39 +08:00
Chris Tsang
46d9fd30e6 Try DeriveEntity 2021-09-07 22:08:57 +08:00
Chris Tsang
d3132d339d Experiment on cake 2021-09-07 20:42:46 +08:00
Billy Chan
b5d85486dd
Fixup 2021-09-03 14:35:20 +08:00
Chris Tsang
76596da46a
Merge pull request #117 from SeaQL/primary-key-type
`InsertResult` to return the primary key's type
2021-09-03 14:15:11 +08:00
Billy Chan
d14322ad75
WIP (workflow will fail) 2021-09-01 19:05:59 +08:00
Billy Chan
9db0748c64
Non-static link 2021-08-28 20:20:34 +08:00
Billy Chan
484da8f6b6
WIP 2021-08-28 20:00:59 +08:00
Billy Chan
31941d3af6
WIP: Linked (#89) 2021-08-23 23:11:08 +08:00
Billy Chan
38ace07e83 Schema prefix in table join 2021-08-14 18:43:07 +08:00
Billy Chan
e76928f1cc Support join on multiple columns 2021-08-14 00:01:40 +08:00
Billy Chan
69b0ae1177 Custom column names with default 2021-08-13 21:39:50 +08:00
Billy Chan
8b30ef74a2 Customize column names 2021-08-12 22:53:22 +08:00
Chris Tsang
e228ada74a Restore example 2021-08-08 15:32:31 +08:00
Chris Tsang
fbb09e17a7 Remove files 2021-08-07 23:19:21 +08:00
Chris Tsang
e40455e771 Use SeaQL/strum 2021-07-01 21:07:23 +08:00
Billy Chan
7bf79ae5bf Re-export strum_macros 2021-07-01 19:12:52 +08:00
Chris Tsang
0a215f75ed Docs 2021-06-28 02:10:46 +08:00
Chris Tsang
9f93c7ed6f Use find_related in place of find_cake 2021-06-28 01:34:49 +08:00
Chris Tsang
cbf16102c0 has_one and belongs_to 2021-06-22 15:52:22 +08:00
Chris Tsang
d77a7c8ab4 Has many relation to be auto defined 2021-06-22 01:30:21 +08:00