9ceac5c639
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
77 lines
1.8 KiB
Go
77 lines
1.8 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
// source: lidarr_config.sql
|
|
|
|
package dbq
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const getLidarrConfig = `-- name: GetLidarrConfig :one
|
|
SELECT id, enabled, base_url, api_key, default_quality_profile_id,
|
|
default_root_folder_path, created_at, updated_at
|
|
FROM lidarr_config
|
|
WHERE id = 1
|
|
`
|
|
|
|
func (q *Queries) GetLidarrConfig(ctx context.Context) (LidarrConfig, error) {
|
|
row := q.db.QueryRow(ctx, getLidarrConfig)
|
|
var i LidarrConfig
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Enabled,
|
|
&i.BaseUrl,
|
|
&i.ApiKey,
|
|
&i.DefaultQualityProfileID,
|
|
&i.DefaultRootFolderPath,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateLidarrConfig = `-- name: UpdateLidarrConfig :one
|
|
UPDATE lidarr_config
|
|
SET enabled = $1,
|
|
base_url = $2,
|
|
api_key = $3,
|
|
default_quality_profile_id = $4,
|
|
default_root_folder_path = $5,
|
|
updated_at = now()
|
|
WHERE id = 1
|
|
RETURNING id, enabled, base_url, api_key, default_quality_profile_id,
|
|
default_root_folder_path, created_at, updated_at
|
|
`
|
|
|
|
type UpdateLidarrConfigParams struct {
|
|
Enabled bool
|
|
BaseUrl *string
|
|
ApiKey *string
|
|
DefaultQualityProfileID *int32
|
|
DefaultRootFolderPath *string
|
|
}
|
|
|
|
func (q *Queries) UpdateLidarrConfig(ctx context.Context, arg UpdateLidarrConfigParams) (LidarrConfig, error) {
|
|
row := q.db.QueryRow(ctx, updateLidarrConfig,
|
|
arg.Enabled,
|
|
arg.BaseUrl,
|
|
arg.ApiKey,
|
|
arg.DefaultQualityProfileID,
|
|
arg.DefaultRootFolderPath,
|
|
)
|
|
var i LidarrConfig
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Enabled,
|
|
&i.BaseUrl,
|
|
&i.ApiKey,
|
|
&i.DefaultQualityProfileID,
|
|
&i.DefaultRootFolderPath,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|