Builder interface for History objects#933
Merged
conradludgate merged 6 commits intoatuinsh:mainfrom Jun 15, 2023
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
Author
|
I'll create PRs with other changes from #882 after this PR is resolved, because they depend on changes from this one |
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
utterstep
commented
May 3, 2023
2db3f93 to
42552f2
Compare
WIP: remove `HistoryWithoutDelete`, add some docstrings, tests
Assure in compile-time that all required fields are set for the given construction scenario
42552f2 to
4a83530
Compare
conradludgate
approved these changes
Jun 15, 2023
Collaborator
conradludgate
left a comment
There was a problem hiding this comment.
Thanks, and sorry this took so long. I made some changes that would have been too complicated to try and explain.
I removed the HistorySeal as it's unnecessary pedantry, although I admire the effort for strict type safety
Contributor
Author
|
Thanks for your help and attention :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also part of #882
Allow History to be created through typed builder interface, powered by
typed-buildercrate.This allows to specify different required fields for a different scenarios:
commandandtimestampand may have some other fields specified, if shell history stores themtimestamp,commandandcwd. These are only fields accessible at hook'sstartphase, all the other ones (duration,exitand such) are added after command is executed, on an instance, queried from DB by id.I've also added documentation for
Historyand provided builders, and added_sealfield to theHistoryto ensure that it could not be erroneously constructed from outside without going through the builder, which enforces required constraints.