underscore/pointer.go
2024-10-15 23:33:46 -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
}