package
0.1.11
Repository: https://github.com/gotidy/lib.git
Documentation: pkg.go.dev

# README

GoDev

ptr contains functions for simplified creation of pointers from constants of basic types.

Examples

Getting pointer

This code:

p := ptr.Of(10)

is the equivalent for:

i := int(10)
p := &i  

Getting value


p := ptr.Of(10) 
v := ptr.Value(ptr.Of(10)) // This code returns 10.

p = nil
v = ptr.Value(p) // This code returns the default value 0.

v = ptr.ValueDef(p, 100) // This code returns default value 100.

Documentation

GoDoc

License

Apache 2.0