33 Commits

Author SHA1 Message Date
Forest Anderson
bb39684f48
Add JsonBinary attribute (#1346)
* Add JsonBinary attribute to column

* Add Postgres test section, test binary json

* Added expanded entity format test

* Fixed unit test
2023-01-18 19:09:01 +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
Billy Chan
384ac1bea6
Cont. sea-orm-cli Implement derives & attributes parameters for entity generation (#1321)
* sea-orm-cli Implement derives & attributes parameters for entity generation (#1124)

* implement derives & attributes for cli

* fmt and clippy fix

* use comma delimiter for attributes arg

* Update help message use `'` instead of `"` to quote

* Refactoring

* remove unnecessary cloning

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

* [CLI] generate model with extra derives and attributes

* clippy

Co-authored-by: Isaiah Gamble <77396670+tsar-boomba@users.noreply.github.com>
2022-12-20 12:59:42 +08:00
Billy Chan
9282ce2ded
Cont. Add serde skip options for hidden columns to the CLI (#1320)
* Add serde skip options for hidden columns to the CLI (#1171)

* Add serde skip options for hidden columns to the CLI

* Resolve rustfmt and clippy issues

* Use SerdeDeriveOptions instead of WithSerde in tests

* Resolve upstream conflict

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

* [CLI] serde_skip_hidden_column

* clippy

* clippy

Co-authored-by: Jacob Trueb <jtrueb@northwestern.edu>
2022-12-20 00:43:21 +08:00
Billy Chan
3f00725ee2
Cli serde skip deserialize for primary key option (#1186) (#1318)
* Cli serde skip deserialize for primary key option (#1186)

* Add CLI option to skip primary keys with serde

Implements: https://github.com/SeaQL/sea-orm/issues/841

* Codegen: fix tests

* complete skip_deserialize cli feature

* run fmt

* fix tests

Co-authored-by: witcher <witcher@wiredspace.de>

* [cli] should be `#[serde(skip_deserializing)]`

* [CLI] code refactor

* [cli] rename

Co-authored-by: Isaiah Gamble <77396670+tsar-boomba@users.noreply.github.com>
Co-authored-by: witcher <witcher@wiredspace.de>
2022-12-19 22:11:45 +08:00
Billy Chan
5e0c625ac0
Fix - vector of float & double does not derive Eq (#1158)
* Fix - vector of float & double does not derive Eq

* clippy

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-10-27 00:40:03 +08:00
Billy Chan
b5b9790252
Support array datatype in PostgreSQL (#1132)
* PostgreSQL array (draft)

* Fixup

* Fixup

* Fixup

* Fixup

* Fixup

* Refactoring

* generate entity for Postgres array fields

* Add tests

* Update Cargo.toml

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-10-23 18:26:57 +08:00
Lingxiang "LinG" Wang
a349f13fd7
Struct / enum derive PartialEq should also derive Eq (#988)
* add Eq

* Fix clippy warnings

* Fix test cases

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-09-25 10:38:05 +08:00
Billy Chan
6ba8e1b9f1
DeriveRelation on empty Relation enum (#1019) 2022-09-25 10:17:39 +08:00
Billy Chan
c5aa63e282
Generate entity files with PostgreSQL's schema name (#422)
* feat(codegen): generate entity files with PostgreSQL's schema name

* Ignore schema name `public`

* Restore changes

* Fix test cases

* cargo fmt

* [cli] fixup
2022-07-11 23:11:04 +08:00
Billy Chan
73701fef9a
Codegen Unsigned Integer - 2 (#397)
* feat: codegen unsigned integer

* feat: apply alias on `ColumnRef::SchemaTableColumn`

* Update SQLite test cases, quote identifier with double quotes

* Bump sea-query version to 0.22

* Add dummy line

* Tests [cli] and [issues]

* update sea-schema

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-03-14 12:40:02 +08:00
Billy Chan
21216f3a97
Codegen column_name proc_macro attribute (#433)
* feat: codegen `column_name` proc_macro attribute

* test: codegen `column_name`
2022-02-05 21:14:10 +08:00
Billy Chan
ccb8b95324
Codegen Handle Self Referencing & Multiple Relations to the Same Related Entity (#347)
* [sea-orm-codegen] handle self referencing relation & multiple relations to the same related entity

* Test [cli]

* Test [cli]
2021-12-04 21:22:10 +08:00
Billy Chan
8b217239fd
Fix clippy warnings 2021-11-08 12:13:29 +08:00
Tim Eggert
b6c5d71fe2 Introduce optional serde support for model code generation
This introduces several things to optionally support automatic derive attributes for `serde::{Deserialize, Serialize}` for the generated models:
- introduces a `WithSerde` enum to indicate if Serialize, Deserialize, or even both should be derived from,
- adds an optional cli argument `--with-serde [none: default, serialize, deserialize, both]`
- adds test harness for both compact and expanded generation
2021-10-11 14:55:00 +02: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
01011cf0f4
Generate macro attribute "nullable" 2021-09-15 10:46:12 +08:00
Billy Chan
848a15856b
Fix test cases 2021-09-14 00:08:20 +08:00
Billy Chan
9c3aba8c0e
codegen of compact entity files 2021-09-10 22:28:08 +08:00
Billy Chan
10a5a34cd9
Move files 2021-09-10 22:28:08 +08:00
Billy Chan
d14322ad75
WIP (workflow will fail) 2021-09-01 19:05:59 +08:00
Billy Chan
484da8f6b6
WIP 2021-08-28 20:00:59 +08:00
Billy Chan
aea4ec2d54 Codegen mod.rs include prelude 2021-08-17 12:45:21 +08:00
Billy Chan
ba226a2b62
Generate arbitrary named entity (#70)
* Generate arbitrary named entity (#69)

* Bump cli & codegen version

* CI tests no caching

* Remove local dependency path
2021-08-10 16:35:10 +08:00
Chris Tsang
fbb09e17a7 Remove files 2021-08-07 23:19:21 +08:00
Billy Chan
f75fcd8fdf Update unit test 2021-07-22 19:08:42 +08:00
Chris Tsang
9334d4ff5d DbBackend alias 2021-07-17 22:03:41 +08:00
Billy Chan
e83cc63e3a Replacing Syntax & *BuilderBackend with DatabaseBackend 2021-07-16 00:28:03 +08:00
Billy Chan
d59ee1e298 Mock any database 2021-07-14 21:31:59 +08:00
Billy Chan
b4abf15169
Hotfix - doc test fail, Ignore fmt entity files under codegen/tests 2021-07-14 10:27:12 +08:00
Chris Tsang
bcd221a915 Add Syntax to Statement 2021-07-13 22:39:29 +08:00
Billy Chan
a94224e0f2 Unit test sea-orm-codegen 2021-07-12 23:45:27 +08:00