Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deref ¶
func Deref[T any](v *T) T
Deref will return the referenced value, or if the pointer has no value, then it returns with the zero value.
Example ¶
package main import ( "github.com/adamluzsi/frameless/pkg/pointer" ) type ExampleStruct struct { StrPtrField *string IntPtrField *int } func main() { var es ExampleStruct _ = pointer.Deref(es.StrPtrField) _ = pointer.Deref(es.IntPtrField) }
Output:
func Of ¶
func Of[T any](v T) *T
Of takes the pointer of a value.
Example ¶
package main import ( "github.com/adamluzsi/frameless/pkg/pointer" ) type ExampleStruct struct { StrPtrField *string IntPtrField *int } func main() { _ = ExampleStruct{ StrPtrField: pointer.Of("42"), IntPtrField: pointer.Of(42), } }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.