converters

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package converters provides safe type conversion functions.

Index

Constants

This section is empty.

Variables

View Source
var ErrNegativeValue = ewrap.New("negative values cannot be converted to unsigned integers")

ErrNegativeValue is returned when attempting to convert a negative number to an unsigned type.

Functions

func SafeIntFromInt64

func SafeIntFromInt64(value int64) (int, error)

SafeIntFromInt64 converts an int64 to int, ensuring the value fits in the target type.

func SafeUint64FromInt

func SafeUint64FromInt(value int) (uint64, error)

SafeUint64FromInt converts an int to uint64 while guarding against negative values and overflow.

func SafeUint64FromInt64

func SafeUint64FromInt64(value int64) (uint64, error)

SafeUint64FromInt64 converts an int64 to uint64 while guarding against negative values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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