autobrr/internal/database/utils.go
ze0s 45b522abf8
chore: update license header year (#1332)
* chore: update license header year

* chore: update license header year tsx files

* chore: update license header
2024-01-01 16:21:02 +01:00

44 lines
734 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.NullString {
return sql.NullString{
String: 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,
}
}