tools

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsDuration

func AbsDuration(duration time.Duration) time.Duration

func ExpandPath

func ExpandPath(path string) string

func FmtTokenAmount

func FmtTokenAmount(value string) float64

func HumanFloat64

func HumanFloat64(v float64) string

func HumanPercent

func HumanPercent(x float64) string

func HumanSignedPercent

func HumanSignedPercent(x float64) string

func NormalizeFloat64Series added in v0.0.4

func NormalizeFloat64Series(series []float64) []float64

func PathExists

func PathExists(name string) (bool, error)

func ReadHTTPRequest

func ReadHTTPRequest(req *http.Request, client *http.Client) ([]byte, error, int, http.Header)

ReadHTTPRequest reads data from an http request

func ReadHTTPResponse

func ReadHTTPResponse(resp *http.Response) ([]byte, error, int, http.Header)

ReadHTTPResponse reads data from an http response

func ReverseFloat64Array

func ReverseFloat64Array(a []float64)

func ReverseIntArray added in v0.0.13

func ReverseIntArray(input []int) []int

func ReverseStringArray added in v0.0.12

func ReverseStringArray(input []string) []string

func SortAndReturnIndex added in v0.0.10

func SortAndReturnIndex(nums []float64) []int

func StringInSlice added in v0.0.14

func StringInSlice(a string, list []string) bool

func ToDecimal added in v0.0.6

func ToDecimal(ivalue interface{}, decimals int) decimal.Decimal

Types

type Result

type Result[T any] struct {
	Value T
	Err   error
}

func ErrorResult

func ErrorResult[T any](err error) Result[T]

func ResultFrom

func ResultFrom[T any](v T, err error) Result[T]

func SuccessResult

func SuccessResult[T any](v T) Result[T]

func (*Result[T]) IsErr

func (r *Result[T]) IsErr() bool

Jump to

Keyboard shortcuts

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