151 Commits

Author SHA1 Message Date
Billy Chan
51e6ad7170
Cast primary key column inside returning expression of insert statement (#1427) 2023-01-29 12:58:32 +08:00
Billy Chan
08a5e87e22
Replace SeaORM's ColumnType (#1395)
* Replace SeaORM's `ColumnType`

* Bump SeaQuery's version

* Fix merge conflict

* refactor
2023-01-29 11:06:01 +08:00
Billy Chan
71dbffc725
Fix clippy (#1426)
* Fix clippy

* Fix clippy
2023-01-27 18:50:20 +08:00
Billy Chan
cb71e265df
Unchanged ActiveValue as Set (#1177)
* Unchanged ActiveValue as Set

* Renaming

* Rename

* Rename methods
2023-01-12 15:42:13 +08:00
Billy Chan
e9df3aa01d
Casting columns as a different data type on select, insert and update (#1304)
* Cast select and value

* Refactoring

* Test casting Postgres citext

* Fixup

* Revert

* Add test cases

* Fixup

* Rename methods
2023-01-12 14:56:11 +08:00
Billy Chan
cbd7a8d1c9
Cleanup the use of vec![] (#1367)
* Public methods accept any IntoIterator as argument

* refactoring
2023-01-11 14:17:06 +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
fa94521c25
[issues] fully qualified IdenStatic::as_str() (#1280) 2022-12-06 12:00:43 +08:00
Billy Chan
2389a4c83e
Fix: fields with type Option<T> are always nullable (#1257) 2022-12-01 12:27:49 +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
9dfc481c3b
Fix clippy warnings (#1188)
* Fix clippy warnings

* More fixes
2022-11-04 19:14:31 +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
Chris Tsang
50fa0843ae Qualify DbErr 2022-10-23 23:21:21 +08:00
Billy Chan
a766500ebf
Cont. "Enable convert from ActiveModel to Model" (#990)
* Changelog

* Enable convert from ActiveModel to Model (#725)

* feat: enable convert from ActiveModel to Model

* feat: add tests for converting from ActiveModel to Model

* cargo fmt

* Refactoring

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

* Fix clippy warnings

* Use error type

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
Co-authored-by: greenhandatsjtu <40566803+greenhandatsjtu@users.noreply.github.com>
2022-10-23 23:12:22 +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
29da37b4f2
Merge branch 'master' into sea-query-v0.27 2022-10-17 17:53:41 +08:00
Billy Chan
671d79469a
Fixup 2022-10-17 17:25:35 +08:00
Chris Tsang
5d752e60b9
Merge pull request #1002 from SeaQL/better-errors
Better error system
2022-10-07 00:24:41 +08:00
Billy Chan
29deb0dfd1
Better compile error for entity without primary key (#1020) 2022-10-06 23:50:39 +08:00
Nick Burrett
9eacecd364
FromJsonQueryResult: add missing module prefix to sea_query (#1081) 2022-09-29 10:47:08 +08:00
Billy Chan
77bddd85a5
Fixup 2022-09-22 15:07:37 +08:00
Billy Chan
6564ddac15
Testing [issues] [cli] 2022-09-01 16:39:18 +08:00
Billy Chan
4e835f2ee1
. 2022-09-01 16:38:47 +08:00
Chris Tsang
85533a3bb3 Give up and fix tests 2022-08-28 14:54:26 +08:00
Chris Tsang
348e841139 Refactor ColumnFromStrErr 2022-08-28 13:30:51 +08:00
Billy Chan
d6831e5295
Bump version of sqlx, sea-query, sea-schema, time and uuid (#834)
* Bump version of sqlx, sea-query, sea-schema, time and uuid

* PostgreSQL `u32` was wrapped in `Oid` (launchbadge/sqlx#1602)

* Update test cases

* Fix clippy warnings

* cargo fmt

* Fix clippy warnings

* Bump sea-schema to ^0.9.2

* Update test cases

* Pin on sea-query minor version
2022-07-05 01:05:11 +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
ab2f784701
(de)serialize custom JSON types - 2 (#794)
* de(serialize) custom JSON types

* Rename DeriveTryGetableFromJson -> FromJsonQueryResult

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-07-01 01:27:46 +08:00
Billy Chan
1054d6451c
Use file!() macro to avoid manually defining the name of migration (#736)
* Add `DeriveMigrationName`

* CLI migrate generate without replacing migration name

* Update migrations

* Fixup
2022-06-29 00:42:59 +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
Billy Chan
840f8f6148
DeriveEntityModel macros override column name (#695)
* Override column name with the name of model field in `DeriveEntityModel` macros [issues]

* Fixup: trim prefix and tailing underscore

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-05-09 22:08:59 +08:00
Billy Chan
5a123b36aa
DerivePrimaryKey with custom primary key column name (#694)
* `DerivePrimaryKey` with custom primary key column name

* Add test cases [issues]
2022-05-09 22:00:04 +08:00
Allen
bdd9133aa6 fix lints and warnings
also clean up impl_into_active_value macro
2022-04-09 16:52:47 -07: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
Chris Tsang
cf793aaf38
Merge pull request #494 from smrtrfszm/master
Remove `r#` prefix when deriving `FromQueryResult`
2022-02-05 23:38:53 +08:00
Chris Tsang
646990ed6d
Merge pull request #495 from tasn/patch-1
Fix FromQueryResult when Result is redefined
2022-02-05 20:49:27 +08:00
Billy Chan
5a2ccf5a29 Fully quantity std::result::Result in proc_maros 2022-02-01 15:04:58 +02:00
Chris Tsang
e63d463155
Merge pull request #489 from SeaQL/date-time-utc-local
Support `DateTime<Utc>` & `DateTime<Local>`
2022-02-01 15:25:39 +08:00
Billy Chan
8145088814 Refactoring
`ColumnDef` with default value

Cargo fmt

Update docs

Fixup

Support `DateTimeLocal`

Update docs

Codegen write db timestamp column as `DateTimeUtc` type

Update dependency

Merge branch 'sea-query/add-new-column-ref' into pr/429

feat: apply alias on `ColumnRef::SchemaTableColumn`
2022-02-01 14:29:03 +08:00
Tom Hacohen
30e7625300
Fix FromQueryResult when Result is redefined
Macros should only ever use absolute import paths.
Shorthands can clash (as they have in my case).
2022-01-30 13:00:02 +02:00
Szepesi Tibor
660f23313e
Remove r# prefix from column name when field has a raw identifier 2022-01-29 18:14:23 +01:00
Billy Chan
76c0d7fff5
Name conflict of foreign key constraints when two entities have more than one foreign keys (#417)
* fix: name conflict of foreign key constraints when two entities have more than one fk

* test: update test case's foreign keys

* feat: override default name of foreign key constraint
2022-01-28 01:03:24 +08:00
Billy Chan
2e038a7eae
feat: allow model with generics attribute (#400) 2022-01-14 01:18:13 +08:00
Billy Chan
adfb9ead54
Rework ActiveValue (#340)
* WIP

* Fixup

* Fixup

* Update docs & rename `unset`

* Deprecate `Unset()` and reexport `ActiveValue::NotSet`

* Docs

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2021-12-19 02:22:30 +08:00
Billy Chan
acf8eac441
Show tracing log only when test failed 2021-12-17 12:52:33 +08:00
Chris Tsang
7da5b6bf90
Merge pull request #373 from nappa85/master 2021-12-15 00:49:52 +08:00
Marco Napetti
8ad9781a3f Remove debug features 2021-12-09 16:20:53 +01:00
Emile Fugulin
aaec1bc845 Use attribute instead of compilation flag 2021-12-08 13:50:34 -05:00