mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
refactor(database): clean-up queries (#569)
* fix(database): build WHERE using squirrel * flip LIKEs * change sql.LevelReadCommitted * feat(db): add missing commits * implement single query for releases * cleanup * feat(releases): properly handle limit for Find * feat(releases): make dynamic ILike helper * feat(releases): check for empty ReleaseActionStatus * add values as sql.NullX * check if ID is non 0 * feat(releases): improve find
This commit is contained in:
parent
e6c48a5228
commit
19b3899a5c
12 changed files with 206 additions and 168 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/autobrr/autobrr/internal/logger"
|
||||
"github.com/autobrr/autobrr/pkg/errors"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/lib/pq"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
@ -55,7 +56,7 @@ func (r *APIRepo) Store(ctx context.Context, key *domain.APIKey) error {
|
|||
func (r *APIRepo) Delete(ctx context.Context, key string) error {
|
||||
queryBuilder := r.db.squirrel.
|
||||
Delete("api_key").
|
||||
Where("key = ?", key)
|
||||
Where(sq.Eq{"key": key})
|
||||
|
||||
query, args, err := queryBuilder.ToSql()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue