Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…ey acquisition logic (#4546) `pgsql driver`中`getPrimaryKeys`未使用现有缓存,导致每次`insert`都会重新查询表字段
`gf gen dao`生成`entity`时支持数据库`uuid`类型字段生成`github.com/google/uuid`的`uuid.UUID`类型字段
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Contributor
3 tasks
Co-authored-by: Copilot <[email protected]>
hailaz
approved these changes
Dec 9, 2025
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.
This pull request introduces significant improvements to the handling of the
ReplaceandSaveoperations for multiple database drivers, especially for MSSQL and PostgreSQL. The changes ensure that these operations now auto-detect primary keys when conflict columns are not explicitly provided, improving usability and aligning behavior across drivers. Additionally, the pull request updates related tests to reflect these enhancements and includes some minor documentation and code cleanup.Key changes:
Enhanced Replace/Save Logic for Database Drivers
MSSQL Driver:
ReplaceandSaveoperations now auto-detect primary keys ifOnConflictis not specified, using theMERGEstatement for upsert functionality. If no primary key is found in the data, a detailed error is returned. [1] [2]Replacecorrectly updates or inserts records, and that missing conflict columns are properly handled. [1] [2]PostgreSQL Driver:
ReplaceandSavenow auto-detect primary keys for conflict resolution ifOnConflictis not set, and treatReplaceas aSaveoperation.SaveandReplacework as expected, including verifying data replacement and insertion. [1] [2] [3]DM Driver:
OnConflictis not specified, and provides clearer error messages.Minor Improvements and Documentation
DoInsertmethods for ClickHouse, DM, MSSQL, Oracle, and PostgreSQL drivers, specifying that the input list must have at least one validated record. [1] [2] [3] [4] [5]Workflow and Documentation Updates
Replacesupport from the SQLite driver documentation.These changes improve the consistency, reliability, and developer experience when performing upsert operations across different database backends.