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

feat: update gvg save logic #1345

Merged
merged 5 commits into from Feb 19, 2024
Merged

feat: update gvg save logic #1345

merged 5 commits into from Feb 19, 2024

Conversation

annielz
Copy link
Collaborator

@annielz annielz commented Feb 5, 2024

Description

Update gvg save logic to handle default values (0, nil etc.) to be saved into db.

Rationale

To make sure the gvg values are correctly saved in db.

Example

N/A

Changes

Notable changes:

  • virtual group db update/delete (global virtual group, global virtual group family, local virtual group)

Potential Impacts

  • virtual group db save

@@ -41,7 +41,18 @@ func (db *DB) SaveGVGToSQL(ctx context.Context, gvg *models.GlobalVirtualGroup)
}

func (db *DB) UpdateGVGToSQL(ctx context.Context, gvg *models.GlobalVirtualGroup) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&models.GlobalVirtualGroup{}).TableName()).Where("global_virtual_group_id = ?", gvg.GlobalVirtualGroupId).Updates(gvg).Statement
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&models.GlobalVirtualGroup{}).TableName()).Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "global_virtual_group_id"}},
Copy link
Collaborator

Choose a reason for hiding this comment

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

please update or create corresponding UT

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

UTs added.

annielz and others added 4 commits February 6, 2024 15:30
* feat: expect lvg case fail and other pass

* feat: try2

* fix: gvg test

* fix: 2

* feat: update lvg

* fix: db

* feat: try 3

* feat: add where to update

* feat: update test with removed

* feat: update tests

* fix: lvg

* fix: gvg

* fix: delete gvg

* feat: cleanup
@annielz annielz merged commit 4b041fb into develop Feb 19, 2024
11 checks passed
@annielz annielz deleted the feat-update-gvg-save-logic branch February 19, 2024 06:33
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.

None yet

4 participants