underscore/pointers.go
Ruidy fbf58eff42
Refresh documentation (#39)
* minor documentation fixes

* fix Hugo warnings

* add openssf badge
2024-12-03 09:29:53 +01:00

22 lines
306 B
Go

package underscore
// ToPointer Convert values to pointers
//
// Instead of:
// v := "value"
// MyPointerVar = &v
//
// Or
// v1 := "value1"
// v2 := 100
//
// obj := Obj{
// Field1: &v,
// Field2: &v2,
// }
//
// Use:
// MyPointerVar = ToPointer("value")
func ToPointer[T any](in T) *T {
return &in
}