mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 02:26:42 +00:00
function comment update
This commit is contained in:
parent
1e26bbee7a
commit
004faee9a6
1 changed files with 10 additions and 1 deletions
11
pointers.go
11
pointers.go
|
|
@ -3,9 +3,18 @@ package underscore
|
|||
// Convert values to pointers
|
||||
//
|
||||
// Instead of:
|
||||
// v = "value"
|
||||
// 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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue