Skip to content

Replace calls to xorm UseBool with Where #2237

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

Merged
merged 1 commit into from
Aug 1, 2017
Merged

Conversation

dubeg
Copy link
Contributor

@dubeg dubeg commented Jul 31, 2017

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.

@lafriks
Copy link
Member

lafriks commented Jul 31, 2017

LGTM

@bkcsoft bkcsoft added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jul 31, 2017
@lafriks lafriks added this to the 1.2.0 milestone Jul 31, 2017
@lunny
Copy link
Member

lunny commented Aug 1, 2017

LGTM

@bkcsoft bkcsoft added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 1, 2017
@lunny lunny merged commit 66e8262 into go-gitea:master Aug 1, 2017
}

has, err := x.UseBool().Get(loginSource)
loginSource := new(LoginSource)
Copy link
Member

Choose a reason for hiding this comment

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

Go changed their idiom for allocating things to this: loginSource := &LoginSource{}

@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants