mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
* Add identify task * Change type naming * Debounce folder select text input * Add generic slice comparison function
54 lines
777 B
Go
54 lines
777 B
Go
package models
|
|
|
|
import (
|
|
"database/sql"
|
|
"strconv"
|
|
)
|
|
|
|
func NullString(v string) sql.NullString {
|
|
return sql.NullString{
|
|
String: v,
|
|
Valid: true,
|
|
}
|
|
}
|
|
|
|
func NullStringPtr(v string) *sql.NullString {
|
|
return &sql.NullString{
|
|
String: v,
|
|
Valid: true,
|
|
}
|
|
}
|
|
|
|
func NullInt64(v int64) sql.NullInt64 {
|
|
return sql.NullInt64{
|
|
Int64: v,
|
|
Valid: true,
|
|
}
|
|
}
|
|
|
|
func nullStringPtrToStringPtr(v *sql.NullString) *string {
|
|
if v == nil || !v.Valid {
|
|
return nil
|
|
}
|
|
|
|
vv := v.String
|
|
return &vv
|
|
}
|
|
|
|
func nullInt64PtrToIntPtr(v *sql.NullInt64) *int {
|
|
if v == nil || !v.Valid {
|
|
return nil
|
|
}
|
|
|
|
vv := int(v.Int64)
|
|
return &vv
|
|
}
|
|
|
|
func nullInt64PtrToStringPtr(v *sql.NullInt64) *string {
|
|
if v == nil || !v.Valid {
|
|
return nil
|
|
}
|
|
|
|
vv := strconv.FormatInt(v.Int64, 10)
|
|
return &vv
|
|
}
|