feat: sqlc, nix formatting

This commit is contained in:
2025-04-16 00:58:44 -04:00
parent 32f85fd0be
commit 967e2650ad
74 changed files with 1962 additions and 6811 deletions

View File

@ -0,0 +1,17 @@
package util
func DerefOrEmpty[T any](val *T) T {
if val == nil {
var empty T
return empty
}
return *val
}
func IsNotNil[T any](val *T) bool {
return val != nil
}
func ToPointer[T any](val T) *T {
return &val
}

View File

@ -0,0 +1,44 @@
package util
import (
"fmt"
"time"
"google.golang.org/protobuf/types/known/timestamppb"
)
func NullLike(s *string) *string {
if s == nil {
return nil
}
ts := fmt.Sprintf("%%%s%%", *s)
return &ts
}
func NullTimestamp(ts *timestamppb.Timestamp) *time.Time {
if ts == nil {
return nil
}
t := ts.AsTime()
return &t
}
func NullFloat64(f *float32) *float64 {
if f == nil {
return nil
}
f64 := float64(*f)
return &f64
}
func NullInt64(i *int32) *int64 {
if i == nil {
return nil
}
i64 := int64(*i)
return &i64
}