Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#661: Add flag to sea-orm-cli to generate code for time crate #724

Merged
merged 9 commits into from
Jul 10, 2022
Merged

#661: Add flag to sea-orm-cli to generate code for time crate #724

merged 9 commits into from
Jul 10, 2022

Conversation

nahuakang
Copy link
Contributor

PR Info

Adds

  • Adds a new flag date-time-crate to sea-orm-cli, which enables users to generate entities with either chrono or time crates

Fixes

  • N/A

Breaking Changes

  • N/A

Changes

  • Introduces EntityWriterContext that handles expanded_format, with_serde and date_time_crate per discussion here:
pub struct EntityWriterContext {
    pub(crate) expanded_format: bool,
    pub(crate) with_serde: WithSerde,
    pub(crate) date_time_crate: DateTimeCrate,
}

sea-orm-cli/src/cli.rs Outdated Show resolved Hide resolved
@nahuakang nahuakang requested a review from billy1624 May 13, 2022 12:38
@ikrivosheev
Copy link
Member

I think we can merge this after: #706.

@nahuakang
Copy link
Contributor Author

@ikrivosheev Sounds good. I'll make the cli adjustment to clap derive after #706 merged.

@ikrivosheev
Copy link
Member

@nahuakang, hello, can you resolve conflicts?

@nahuakang
Copy link
Contributor Author

Sure, I'll get this done this week 👍

@billy1624
Copy link
Member

We have upgraded clap to 3.2. We could rebase current PR onto latest master :)

@nahuakang
Copy link
Contributor Author

@billy1624 @ikrivosheev Just rebased :) I like the new declare style for commands!

Copy link
Member

@ikrivosheev ikrivosheev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nahuakang thank you for PR! One comment)

sea-orm-cli/src/cli.rs Show resolved Hide resolved
Copy link
Member

@ikrivosheev ikrivosheev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nahuakang
Copy link
Contributor Author

@ikrivosheev @billy1624 Tests are failing due to the fact that sea-orm-codegen is required for the arg enum wrapper we implemented yesterday. The failure, I suspect, is due to the fact that sea-orm-codegen isn't included as a dependency for some of the features? Do you have a tip on how to proceed here?

@billy1624 billy1624 mentioned this pull request Jul 3, 2022
3 tasks
sea-orm-cli/src/cli.rs Outdated Show resolved Hide resolved
@billy1624 billy1624 mentioned this pull request Jul 4, 2022
@billy1624
Copy link
Member

@ikrivosheev @billy1624 Tests are failing due to the fact that sea-orm-codegen is required for the arg enum wrapper we implemented yesterday. The failure, I suspect, is due to the fact that sea-orm-codegen isn't included as a dependency for some of the features? Do you have a tip on how to proceed here?

Hey @nahuakang, we could implement the conversion inside commands module, where we have codegen feature enabled, i.e. we have sea-orm-codegen in scope. Feel free to cherry-pick the useful bits

@nahuakang
Copy link
Contributor Author

@billy1624 @ikrivosheev The most recent commit will throw an error as well for the examples tests. Do you know how I should import the enum into cli.rs?

@tyt2y3 tyt2y3 merged commit a1bf662 into SeaQL:master Jul 10, 2022
@tyt2y3
Copy link
Member

tyt2y3 commented Jul 10, 2022

Thank you so much for the contribution. With this addition, we should begin a transition from chrono to time as the default recommended library soon, although we might postpone that to 0.10.0 because I'd imagine quite an amount of work to change everything across the board.

billy1624 added a commit to SeaQL/seaql.github.io that referenced this pull request Jul 13, 2022
tyt2y3 added a commit to SeaQL/seaql.github.io that referenced this pull request Jul 17, 2022
* Custom join condition (SeaQL/sea-orm#793)

* Migration does not depend on entity crate

* Define integer enum with repr[x] syntax

* Document datatype mappings (SeaQL/sea-orm#772)

* Cursor pagination (SeaQL/sea-orm#754, SeaQL/sea-orm#822)

* (de)serialize custom JSON types (SeaQL/sea-orm#794)

* Generate new migration file (SeaQL/sea-orm#656)

* Skip generating entity file for specific tables (SeaQL/sea-orm#837)

* Generate entity with date time crate option (SeaQL/sea-orm#724)

* Drop `SelectTwoMany::one()` method (SeaQL/sea-orm#813)

* Datatype mappings of primitives (SeaQL/sea-orm#850, SeaQL/sea-schema#75)

* Join with table alias (SeaQL/sea-orm#852)

* SQLx logging level (SeaQL/sea-orm#800)

* Insert with on conflict (SeaQL/sea-orm#791)

* Migrate generate should take file name as argument instead of option (SeaQL/sea-orm#870)

* Upgrade docusaurus to 2.0.0-beta.22

* What's new in SeaORM 0.9.0

* Move migration section forward

* Rename "Generating Database Schema" section to "Generating SeaQuery Statement"

* Fix broken links

* Edit

* Edit

* Edit

* Edit

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add flag to sea-orm-cli to generate code for time crate
4 participants