utils

package
v0.0.0-...-29e199f Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package utils provides a set of utility methods that can be used across the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultBigIntString

func DefaultBigIntString(ptr *entities.Int256) string

DefaultBigIntString returns an empty string if ptr is nil and the string value of ptr if not

func DefaultIntValue

func DefaultIntValue(realValue, defaultValue int) int

DefaultIntValue returns a default integer value if the real value equals zero

func DefaultString

func DefaultString(src string, defaultValue string) string

DefaultString returns src if it is not empty after trim (TrimSpace) or defaultValue

func DefaultUIntDecString

func DefaultUIntDecString(ptr *entities.UInt64) string

DefaultUIntDecString returns an empty string if ptr is nil and the base 10 string representation if not

func MaxOf

func MaxOf(firstValue int, secondValue int) int

MaxOf returns the maximum of firstValue and secondValue

func MaxValue

func MaxValue(realValue int, maxValue int) int

MaxValue returns maxValue if realValue is greater than maxValue and realValue if it is lower

func PtrIntDefaultValue

func PtrIntDefaultValue(ptr *int, defaultValue int) int

PtrIntDefaultValue returns the default value if ptr is nil and the int value if not

func PtrStringDefaultValue

func PtrStringDefaultValue(ptr *string, defaultValue string) string

PtrStringDefaultValue returns the default value if ptr is nil and the string value if not

func ReadAndResetCloser

func ReadAndResetCloser(reader *io.ReadCloser, pointer any) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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