use nullable for field updates

This commit is contained in:
nkanaev
2026-05-11 10:27:50 +01:00
parent 450f64605e
commit 31274d17a5
6 changed files with 28 additions and 22 deletions

View File

@@ -12,6 +12,15 @@ type Storage struct {
db *sql.DB
}
type Nullable[T any] struct {
Set bool
Value *T
}
func SetNullable[T any](v *T) Nullable[T] {
return Nullable[T]{Set: true, Value: v}
}
func New(path string) (*Storage, error) {
if pos := strings.IndexRune(path, '?'); pos == -1 {
params := "_journal=WAL&_sync=NORMAL&_busy_timeout=5000&cache=shared"