booly

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolOrDefault

func BoolOrDefault(v *bool, defaultVal bool) *bool

BoolOrDefault returns bool if it is not nil, and a pointer to defaultVal otherwise. NOTE: this method is deprecated. Use helpy.DerefOrValue instead.

func FromString

func FromString(s string) bool

FromString parses the string to a bool. Valid input values are any casing of "true" and "false", and 1 and 0. If any other input is given, FromString returns false.

func Pointer

func Pointer(v bool) *bool

Pointer returns a pointer to the given bool. NOTE: this method is deprecated. Use helpy.Pointer instead.

func Random added in v0.1.9

func Random() bool

Random returns a pseudo-random boolean value

func ToInt

func ToInt(b bool) int

ToInt returns 1 if b is true, and 0 if b is false.

func ToString

func ToString(b bool) string

ToString returns "true" or "false", matching the input bool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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