[chore/performance] Remove remaining 'whereEmptyOrNull' funcs (#1946)

This commit is contained in:
tobi 2023-07-05 12:34:37 +02:00 committed by GitHub
commit d9c69f6ce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 38 deletions

View file

@ -102,7 +102,7 @@ func (a *adminDB) NewSignup(ctx context.Context, username string, reason string,
NewSelect().
Model(acct).
Where("? = ?", bun.Ident("account.username"), username).
WhereGroup(" AND ", whereEmptyOrNull("account.domain")).
Where("? IS NULL", bun.Ident("account.domain")).
Scan(ctx); err != nil {
err = a.conn.ProcessError(err)
if err != db.ErrNoEntries {
@ -199,7 +199,7 @@ func (a *adminDB) CreateInstanceAccount(ctx context.Context) db.Error {
TableExpr("? AS ?", bun.Ident("accounts"), bun.Ident("account")).
Column("account.id").
Where("? = ?", bun.Ident("account.username"), username).
WhereGroup(" AND ", whereEmptyOrNull("account.domain"))
Where("? IS NULL", bun.Ident("account.domain"))
exists, err := a.conn.Exists(ctx, q)
if err != nil {