implemented data sources with prisma in go
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package utils
|
||||
|
||||
// Let applies a function `f` to a pointer value `ptr` if it's not nil.
|
||||
// Returns nil if the pointer is nil.
|
||||
func Let[T any, R any](ptr *T, f func(T) R) *R {
|
||||
if ptr == nil {
|
||||
return nil
|
||||
}
|
||||
result := f(*ptr)
|
||||
return &result
|
||||
}
|
||||
Reference in New Issue
Block a user