Use ID or Where to instead directly use Get when load object from database (#11925)
* Use ID or Where to instead directly use Get when load object from database * Apply suggestions from code review Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
61cd0ce866
commit
1645d4a5d8
9 changed files with 25 additions and 28 deletions
|
@ -300,7 +300,7 @@ func (source *LoginSource) SSPI() *SSPIConfig {
|
|||
// CreateLoginSource inserts a LoginSource in the DB if not already
|
||||
// existing with the given name.
|
||||
func CreateLoginSource(source *LoginSource) error {
|
||||
has, err := x.Get(&LoginSource{Name: source.Name})
|
||||
has, err := x.Where("name=?", source.Name).Exist(new(LoginSource))
|
||||
if err != nil {
|
||||
return err
|
||||
} else if has {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue