mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00

* feat: add support for proxies * fix(http): release handler * fix(migrations): define proxy early * fix(migrations): pg proxy * fix(proxy): list update delete * fix(proxy): remove log and imports * feat(irc): use proxy * feat(irc): tests * fix(web): update imports for ProxyForms.tsx * fix(database): migration * feat(proxy): test * feat(proxy): validate proxy type * feat(proxy): validate and test * feat(proxy): improve validate and test * feat(proxy): fix db schema * feat(proxy): add db tests * feat(proxy): handle http errors * fix(http): imports * feat(proxy): use proxy for indexer downloads * feat(proxy): indexerforms select proxy * feat(proxy): handle torrent download * feat(proxy): skip if disabled * feat(proxy): imports * feat(proxy): implement in Feeds * feat(proxy): update helper text indexer proxy * feat(proxy): add internal cache
44 lines
736 B
Go
44 lines
736 B
Go
// Copyright (c) 2021 - 2024, Ludvig Lundgren and the autobrr contributors.
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
package database
|
|
|
|
import (
|
|
"database/sql"
|
|
"path"
|
|
)
|
|
|
|
func dataSourceName(configPath string, name string) string {
|
|
if configPath != "" {
|
|
return path.Join(configPath, name)
|
|
}
|
|
|
|
return name
|
|
}
|
|
|
|
func toNullString(s string) sql.Null[string] {
|
|
return sql.Null[string]{
|
|
V: s,
|
|
Valid: s != "",
|
|
}
|
|
}
|
|
|
|
func toNullInt32(s int32) sql.NullInt32 {
|
|
return sql.NullInt32{
|
|
Int32: s,
|
|
Valid: s != 0,
|
|
}
|
|
}
|
|
func toNullInt64(s int64) sql.NullInt64 {
|
|
return sql.NullInt64{
|
|
Int64: s,
|
|
Valid: s != 0,
|
|
}
|
|
}
|
|
|
|
func toNullFloat64(s float64) sql.NullFloat64 {
|
|
return sql.NullFloat64{
|
|
Float64: s,
|
|
Valid: s != 0,
|
|
}
|
|
}
|