mirror of
https://github.com/rjNemo/underscore
synced 2026-06-10 20:46: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
|
// Convert values to pointers
|
||||||
//
|
//
|
||||||
// Instead of:
|
// Instead of:
|
||||||
// v = "value"
|
// v := "value"
|
||||||
// MyPointerVar = &v
|
// MyPointerVar = &v
|
||||||
//
|
//
|
||||||
|
// Or
|
||||||
|
// v1 := "value1"
|
||||||
|
// v2 := 100
|
||||||
|
//
|
||||||
|
// obj := Obj{
|
||||||
|
// Field1: &v,
|
||||||
|
// Field2: &v2,
|
||||||
|
// }
|
||||||
|
//
|
||||||
// Use:
|
// Use:
|
||||||
// MyPointerVar = ToPointer("value")
|
// MyPointerVar = ToPointer("value")
|
||||||
func ToPointer[T any](in T) *T {
|
func ToPointer[T any](in T) *T {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue