Categorygithub.com/cidverse/go-ptr
modulepackage
0.0.0-20240331160646-489e694bebbf
Repository: https://github.com/cidverse/go-ptr.git
Documentation: pkg.go.dev

# README

go-ptr

A collection of utility functions to work with pointers, commonly used for optional values.

Go Reference

Installation

go get -u github.com/cidverse/go-ptr

Usage

generics

fmt.Printf("%#v\n", ptr.Ptr("hello world"))

Primitives

fmt.Printf("%#v\n", ptr.String("hello world"))
fmt.Printf("%#v\n", ptr.Int("hello world"))

License

Released under the MIT license.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Ptr returns a new pointer to the given value.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Value returns a value behind the pointer or the zero value when the pointer is nil.
ValueOrDefault returns a value behind the pointer or the default value when the pointer is nil.