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

Improve DataObject.save() generation #171

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

jayvdb
Copy link
Collaborator

@jayvdb jayvdb commented Jan 13, 2024

  • Use Self:: and self. more to access existing accessible values, so generated code is easier to read. i.e. less duplicate literals in the output.
    • I am assuming the compiler knows <Self as butane::DataResult>::COLUMNS.len() is a constant.
  • Removes an if values.len() > 0 from the .save() for tables with an AutoPk column that has already been inserted.
    • no doubt the compiler can detect whether values is or is not empty, but a human needs to think about it.
  • Also trim the generated code for a table with only one column which is AutoPk, and add a test case for this.

@jayvdb jayvdb marked this pull request as ready for review January 13, 2024 19:40
@jayvdb jayvdb changed the title Improve generated DataObject.save() Improve DataObject.save() generation Jan 13, 2024
@jayvdb jayvdb merged commit 64eba17 into Electron100:master Jan 15, 2024
1 of 2 checks passed
@jayvdb jayvdb deleted the improve-dataobect-save branch January 15, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants