-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
How to update by force a zero value? #3901
Comments
Update zero fields https://gorm.io/docs/update.html#Update-Selected-Fields |
I don't think it is necessary to add another API to do the job, sounds like just a update zero-value fields issue, which is same if you are using other data types like: |
Selecting explicitly actually does work for zero fields, but if my object has many fields, I don't think it is a good experience everytime to select every feild. Everytime I add or remove a field, I have to add or remove it in the select clause. |
If you want to select all fields, you can use |
|
Select("*").Omit("Name", "Age") |
e, ok |
It doesn't work. Select("*") still ignores all zero values. |
* Spell editing work * Fix some re-rendering * Frame in more fields * Fix warnings * Fix re-render preview issues, add skill dropdown * Add target type select * Add resist type select * Add icon selection * Add tab hover functionality to component * Spell animation preview component * Cleanup video toggle changing * Spell animation * Animation viewer select mock * Update SpellEdit.vue * Implement animation selection * Add selector pulse animation * Hover * Windows fixes (akka) * Adjust animation selector virtual height * Add checkboxes * More checkboxes * Update SpellEdit.vue * Update SpellEdit.vue * Update SpellEdit.vue * Update SpellEdit.vue * Form re-arranging * Update SpellEdit.vue * Update SpellEdit.vue * Regenerate models * Fix operator * Implement spell create / update (save) * Hook up spell class selection * Put deity selector in place * Preselect icon in icon selector * Update SpellIconSelector.vue * Push up pre-selection for spell animation * Tweaks * Scroll to pre-selected spell animation * Implement query free-id-ranges endpoint `query/free-id-ranges/:table/:id` * Copy pasta * Pre free id selector work * Implement free ids reserved * Move query logic to generic function * Cleanup * Highlight fields once changed, change text inputs to update only on change event and not when every single letter is typed * Handle and display save errors * Correct all field types * More field shuffling * Update SpellEdit.vue * Update SpellEdit.vue * Fix item display bugs * Update eq-expansions.ts * Add eq fancy buttons * Beginning of item editor work * Add in item model preview * Add item model selection * Implement Item Icon selection * Lots of component work around bitmask calculators and plug into item editor * Fix non-zero update issue and update all controllers and template go-gorm/gorm#3901 * Update item_controller.go * Mask sure mask is set before rendering component * Tweak calculators * Fix items page zero state * Update Calculators.vue * More changes * More component work * More item editor work * Add damage tab * Tweaks * spell updates * Update spells.ts eye of zomm, teleport updates * Update spells.ts teleport and succor updates * Update spells.ts change size * Update spells.ts * Update spells.ts * Update spells.ts * Update spells.ts * Create eq-spell-spa-definitions.ts * Selector adjustments * More component tweaks * Change item edit layout * Aggregate stats tab * Update InventorySlotCalculator.vue * Lower opacity inputs when value is zero for easier scanning * Update ItemEdit.vue * Implement effect selection * Update spells.ts * Item editor effects adjustments * Update ItemEdit.vue * Update ItemEdit.vue * Delete eq-spell-spa-definitions.ts * Update spells.ts bard effect update * Update spells.ts * Update spells.ts * Update spells.ts * Add new color picker * type descriptions defines added for type descriptions * Update eq-spell-constants.ts * Update spells.ts * Updated DB_SPA list Improved to many descriptions. * Update eq-spell-constants.ts * update 288 needs more work to pull AA spell data * Adjust sizing * Adjust sizes * Add checkbox hover * Additional field work * More fields * Add additional top level tags to card preview * More fields * More field work * Restructure files in project * More project cleanup * Restructure for spell editor * Move viewers to their own folder * Display item cash * Add margin to bottom of preview card * Display light of item * Update ItemEditor.vue * Hook up stat scaling * Tweak scaling * Add stack size to preview * Verbiage change * Add meta tab to items * Add tab hover local setting * Change spacing * Pre-highlight fields being scaled on hover * Adjust highlight effect colors * Add percentage based stat scalers * Refactoring * Implement ItemStatScalePercentage component * More field work * Update ItemEditor.vue * Update ItemEditor.vue * Tweaks * Modified fields now breathe * Update global.css * Update ItemEditor.vue * Tooltips * Tooltips * Update main.ts * Implement color selector * Add bane race field select * UI tweaks * Add material preview * Material * Material tweaks * Add bag type dropdown * Update EQItemCardPreview.vue * Tweaks * Update eq-ui.css * Add selects of data, adjust preview * Update ItemEditor.vue * Add purity * Add augment type calculator * Relocate spell damage * Bag weight reduction * Add elite material and hero forge model * Update ItemEditor.vue * Book fields * Charm * Last remaining fields * Tooltip hover descriptions * More tooltip description work * Aug description * Update ItemEditor.vue * Little bit of spell field rearranging * Hook up tooltip description data * Create eq-spell-spa-definitions.ts * SPA preview work * Spell table preview cleanup * More ui cleanup * Restrictions tab work * Cleanup buffing tab * Casting tab * Move pcnpc_only_flag * General tab * Resist tab * Effects+ tab * Range tab * Tweaks to spell table * Add additional filters to item search * Update Items.vue * Implement additional item filters * More item table preview work * More ui work * Update ItemPreviewTable.vue * UI tweaks * UI tweaks to spells table * More ui tweaks * Loader tweaks * Pre editor changes * More quest editor work * Remove vue form generation * Remove no longer used assets * More adjustments * List files endpoint * More quest editor prototype work * Update ItemPreviewTable.vue * More editor work * updates to effect descriptions * Prep for release Co-authored-by: KayenEQ <kayen85@gmail.com>
Yes, I also encountered this problem. |
I've faced the same trouble. I guess it would be better to implement smth like Approach with a pointer:
Approach with converting a structure to a map:
But, if we want to update an association with zero-value it will work. |
Any update ? Select("*") don't work |
Your Question
I redefine a type and implement interface
driver.Value
anddriver.Scanner
,for instance, I want type[]string
to be stored as a json string, but I need to update it to null even if it is a nil value.Expected answer
I suggest gorm offer an interface
IsZero
as a supplement to the method reflect.field.IsZero.Morever, a field tag
nozero
、nonil
or something like that is also appreciated.The text was updated successfully, but these errors were encountered: