underscore/pointers.go
2024-10-21 15:58:57 -05:00

13 lines
199 B
Go

package underscore
// Convert values to pointers
//
// Instead of:
// v = "value"
// MyPointerVar = &v
//
// Use:
// MyPointerVar = ToPointer("value")
func ToPointer[T any](in T) *T {
return &in
}