conv

package
v0.0.0-...-d280c18 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUintTooLarge = fmt.Errorf("unsigned int value is too large, maximum: %d", uint64(math.MaxUint))
)

Errors that are specific to model conversion.

Functions

func DerefOrZero

func DerefOrZero[T any](s *T) T

DerefOrZero will dereference the value, or return the zero value if it's nil.

func TimeOrNow

func TimeOrNow(t *time.Time) time.Time

TimeOrNow deferences a time pointer, or returns time.Now if it's nil.

func TimePtrLocal

func TimePtrLocal(t *time.Time) *time.Time

TimePtrLocal converts a time to local time, or nil.

func TimePtrUTC

func TimePtrUTC(t *time.Time) *time.Time

TimePtrUTC converts a time to UTC time, or nil.

func Uint64ToUint

func Uint64ToUint(v uint64) (uint, error)

Uint64ToUint converts a uint64 to uint, and errors if uint64 value is larger than what the uint type supports, such as having a value bigger than 2^32-1 in a 32-bit build of Dinkur.

func ZeroAsNil

func ZeroAsNil[T comparable](s T) *T

ZeroAsNil will return a pointer to the value, or nil if the value is zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

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