[PR #2237] [MERGED] Replace calls to xorm UseBool with Where #16300

Closed
opened 2025-11-02 12:07:05 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/2237
Author: @dubeg
Created: 7/31/2017
Status: Merged
Merged: 8/1/2017
Merged by: @lunny

Base: masterHead: fixUseBool


📝 Commits (1)

  • 9727451 Replace calls to xorm UseBool with Where

📊 Changes

2 files changed (+4 additions, -9 deletions)

View changed files

📝 models/login_source.go (+1 -1)
📝 models/oauth2.go (+3 -8)

📄 Description

Filter with Where instead of by struct values with UseBool.

Since new boolean fields can be added to a struct at any time in the future, filtering by struct with UseBool() is dangerous, as it considers as part of the filter all bools in the struct.

Coders shouldnt have to think about the impact new fields have on existing database queries.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/2237 **Author:** [@dubeg](https://github.com/dubeg) **Created:** 7/31/2017 **Status:** ✅ Merged **Merged:** 8/1/2017 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `fixUseBool` --- ### 📝 Commits (1) - [`9727451`](https://github.com/go-gitea/gitea/commit/972745172ae513d712225edb01e0a892a51bb2bd) Replace calls to xorm UseBool with Where ### 📊 Changes **2 files changed** (+4 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `models/login_source.go` (+1 -1) 📝 `models/oauth2.go` (+3 -8) </details> ### 📄 Description Filter with `Where` instead of by struct values with `UseBool`. Since new boolean fields can be added to a struct at any time in the future, filtering by struct with `UseBool()` is dangerous, as it considers as part of the filter all bools in the struct. Coders shouldnt have to think about the impact new fields have on existing database queries. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:07:05 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#16300