187 Commits

Author SHA1 Message Date
Billy Chan
6e47d488d4
Drop SelectTwoMany::one method (#813) 2022-07-10 23:41:10 +08:00
Billy Chan
1a3e8c456a
[CI] run clippy checks & fix clippy warnings (#840)
* Run clippy checks

* Fix clippy warnings

* Clippy checks for `sea-orm-*` crates

* Fix clippy warnings

* Fixup
2022-07-10 15:38:38 +08:00
Chris Tsang
bfe6eb39d5
Cursor pagination (#822)
* Cursor pagination

* Apply filter / range filter on cursor; Allow non-primary key filter

* Fixup

* Update cursor API

* Cursor pagination with composite keys

* Docs

* Rename cursor() to cursor_by()

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-07-10 15:08:38 +08:00
Émile Fugulin
d0aeda7bdd
Add time from u64 (#849) 2022-07-08 18:20:28 +08:00
baoyachi. Aka Rust Hairy crabs
beef8211d8
fix compile error,res args add type (#839)
* fix compile error,res add type

* update .gitignore

* fix compile error

* fix compile error
2022-07-05 16:04:11 +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
Eric
5037dc99ec
Create a num_items_and_pages on the paginator (#768)
* Create a `num_items_and_pages` on the `paginator`

This method allows us to get both number of items and pages of a
paginator with only one database query.

* Improve documentation

* Create a dedicated struct for items and pages number
2022-07-01 02:50:20 +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
Chris Tsang
12ec00272c Revert "Cursor Pagination (#754)"
This reverts commit 6f9dbd260e6e004c369abe0019b4374253db7d3b.
2022-06-26 18:23:47 +08:00
Billy Chan
6f9dbd260e
Cursor Pagination (#754)
* Cursor pagination

* Apply filter / range filter on cursor; Allow non-primary key filter

* Fixup

* Update cursor API

* Cursor pagination with composite keys

* Docs
2022-06-26 17:48:00 +08:00
Allen
bdd9133aa6 fix lints and warnings
also clean up impl_into_active_value macro
2022-04-09 16:52:47 -07:00
Shouvik Ghosh
12f66618f9
Added delete_by_id (#590)
* Added delete_by_id

* Added an integration test

* Added composite key example

* Remove extra find_by_id in delete_by_id test

* Added unit test with composite primary key
2022-03-21 14:41:05 +08:00
shinbunbun
7a86ac0239
Implement PaginatorTrait for SelectorRaw (#617)
* Implement PaginatorTrait for SelectorRaw

* Implement raw test
2022-03-21 14:37:08 +08:00
Chris Tsang
da7cc541eb
Merge pull request #584 from SeaQL/pulls/471
Pulls/471
2022-03-21 01:17:46 +08:00
Billy Chan
9687819a7e
Supports time crate 2022-03-13 18:18:15 +08:00
Billy Chan
f3a7a1398a
Merge branch 'master' into pulls/471 2022-03-07 15:52:12 +08:00
Billy Chan
8eb095385d Migration (#335)
* Refactor `ConnectionTrait`

* Refactoring

* Build index & foreign key statements

* Fix imports

* Fixup

* Rocket example with migration

* async-std compatible with the tokio 1.0 runtime

* Use reexported dependency

* Compile without selecting any db backend

* Updating sea-orm-cli dep

* sea-orm-cli migrate commands

* cargo fmt

* Test [cli]

* Refactoring

* Clap app name should be "sea-orm-cli"

* Correctly capture MIGRATION_DIR

* Rename README

* Add `sea-orm-cli migrate init` command

* Update README

* Try restructured sea-query dependency (SeaQL/sea-schema#41)

* Set `DATABASE_URL` environment variable
2022-02-05 20:34:54 +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
Charles Chege
52f38a10ea Support the use of chrono::DateTime<Utc> in sea-orm
Add documentation for this

Temporarily use a fork to include new Sea-query code

Add tests for DateTimeUtc

Solve Github actions error by add the code to create a table

Assertion accuracy tests

Rectify incorrect format
2022-02-01 14:27:33 +08:00
Sebastian Pütz
f012ccaec3 Add Send bound to streams. 2022-01-19 20:46:10 +01:00
Chris Tsang
47cbf50c3c
Merge branch 'master' into pulls/361 2021-12-25 17:41:29 +08:00
Billy Chan
5104cd3573
Insert & Update Return Model (#339)
* Update insert & update API

* Update test cases

* Update README

* Fix clippy warnings

* Fixup

* Fixup
2021-12-18 14:30:10 +08:00
Billy Chan
006d35313b
Fix clippy warnings 2021-12-17 11:39:53 +08:00
Billy Chan
b9fe878542 Handling MySQL & SQLite timestamp columns 2021-12-11 14:25:45 +08:00
Billy Chan
af1ffdad83
Rename sea-strum lib back to strum 2021-12-07 17:21:03 +08:00
Billy Chan
1229287fd8
Support Up to 6 Values Composite Primary Key (#353)
* Support up to 6 composite primary key

* Test [issues]

* Test [issues]
2021-12-04 20:57:05 +08:00
Jaebum Lee
bc952b3787 Add TryFromU64 trait for DateTime<FixedOffset>.
The timestamp column (with time zone) generates the field with `chrono::DateTime<chrono::FixedOffset>`.
Sadly, `DeriveEntityModel` macro fails because `TryFromU64` is not implemented for this type.

I added the trivial implementation for `chrono::DateTime<chrono::FixedOffset>`.
2021-11-21 23:36:13 -08:00
Billy Chan
65f9c70dd3
cargo fmt 2021-11-18 18:07:24 +08:00
Billy Chan
42404eb525
Fixup 2021-11-16 17:56:22 +08:00
Billy Chan
7298fdeda9
Rewrite doctests 2021-11-16 17:35:49 +08:00
Billy Chan
4c147a2d24
Rewrite doctests 2021-11-16 16:27:54 +08:00
Billy Chan
fd50ffd5ea
Merge remote-tracking branch 'origin/master' into returning 2021-11-16 14:44:12 +08:00
Chris Tsang
d66538d7bc Edit docs 2021-11-14 20:54:15 +08:00
Chris Tsang
aaf6c2555d Refactor and add stream() to SelectorRaw 2021-11-14 20:49:04 +08:00
Chris Tsang
5f2fa55253 Edit docs 2021-11-14 16:58:52 +08:00
Billy Chan
ac804a1642
Imports PaginatorTrait by default making it backward compatible 2021-11-10 15:26:29 +08:00
Billy Chan
1905f62430
cargo fmt 2021-11-10 14:58:06 +08:00
Billy Chan
66c23c85db
Revert MySQL & SQLite returning support 2021-11-10 14:42:19 +08:00
jasper
05181994d3 Move count to PaginatorTrait 2021-11-10 08:57:05 +08:00
jasper
23498892b0 Add PaginatorTrait and CountTrait 2021-11-09 21:33:55 +08:00
Chris Tsang
03d90d8630 Docs 2021-11-09 16:21:12 +08:00
Billy Chan
429b920ded
Fixup 2021-11-09 11:05:55 +08:00
Billy Chan
afdb1afeb8
This will fail loll 2021-11-08 22:12:09 +08:00
Billy Chan
30f43b64c6
Fixup 2021-11-08 19:03:06 +08:00
Billy Chan
0eafacc2a1
Try returning on MariaDB 2021-11-08 17:36:30 +08:00
Billy Chan
732d080020
Update docs 2021-11-08 15:24:51 +08:00
Billy Chan
2f7cffa74d
Fix test cases 2021-11-08 15:12:56 +08:00
Billy Chan
623873678b
Handle "None of the database rows are affected" for Postgres 2021-11-08 15:12:47 +08:00
Billy Chan
50605c731b
FIXME: breaking behaviors 2021-11-05 22:39:25 +08:00
Billy Chan
a977572762
Update with returning for Postgres 2021-11-05 22:13:52 +08:00