zptr

package
v0.19.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package zptr provides utility functions for working with pointers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolOrDefault

func BoolOrDefault(b *bool) bool

BoolOrDefault returns the value pointed to by a bool pointer, or 'false' if the pointer is nil.

func BoolToPtr

func BoolToPtr(b bool) *bool

BoolToPtr takes a boolean value and returns a pointer to a copy of it.

func Float32OrDefault

func Float32OrDefault(f *float32) float32

Float32OrDefault returns the value pointed to by a float32 pointer, or 0.0 if the pointer is nil.

func Float32ToPtr

func Float32ToPtr(f float32) *float32

Float32ToPtr takes a float32 value and returns a pointer to a copy of it.

func Float64OrDefault

func Float64OrDefault(f *float64) float64

Float64OrDefault returns the value pointed to by a float64 pointer, or 0.0 if the pointer is nil.

func Float64ToPtr

func Float64ToPtr(f float64) *float64

Float64ToPtr takes a float64 value and returns a pointer to a copy of it.

func IntOrDefault

func IntOrDefault(i *int) int

IntOrDefault returns the value pointed to by an int pointer, or 0 if the pointer is nil.

func IntToPtr

func IntToPtr(i int) *int

IntToPtr takes an integer value and returns a pointer to a copy of it.

func StringOrDefault

func StringOrDefault(s *string) string

StringOrDefault returns the value pointed to by a string pointer, or an empty string if the pointer is nil.

func StringToPtr

func StringToPtr(s string) *string

StringToPtr takes a string value and returns a pointer to a copy of it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL