safe

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package safe returns a safe scalar value from a possible nil pointer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b interface{}, def ...bool) bool

Bool returns a safe bool from the value

func Int

func Int(i interface{}, def ...int) int

Int returns a safe int64 from the value or default if nil

func Int64

func Int64(i interface{}, def ...int64) int64

Int64 returns a safe int64 from the value or default if nil

func StrEqual

func StrEqual(s1, s2 interface{}) bool

StrEqual compares to values as strings safely

func String

func String(s interface{}, def ...interface{}) string

String handles nil pointers to always return a valid string

func Time

func Time(t interface{}, def ...time.Time) time.Time

Time returns a safe time

func Uint64

func Uint64(i interface{}, def ...uint64) uint64

Uint64 returns a safe uint64 from the value or default if nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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