underscore icon indicating copy to clipboard operation
underscore copied to clipboard

adding support for quick pointer conversion

Open 0syntrax0 opened this issue 1 year ago • 0 comments

Adding support for quick pointer conversion. This is much more helpful when setting up structs with pointer fields.

So that instead of:

v := "value"
MyPointerVar = &v

// or

v1 := "value1"
v2 := 100
v3 := []string{}
obj := Obj {
  Field1: &v1,
  Field2: &v2,
  Field3: &v3,
}

We just use: MyPointerVar = u.ToPointer("value")

obj := Obj {
  Field1: u.ToPointer("value"),
  Field2: u.ToPointer(100),
  Field3: u.ToPointer([]string{}),
}

0syntrax0 avatar Oct 21 '24 21:10 0syntrax0