api

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package utils provides common utility functions.

Provided functionalities: - sorting - comparators

Index

Constants

View Source
const (
	IGNORE_FLOAT = true
)

Variables

View Source
var (
	ErrInvalidCopyDestination = errors.New("copy destination is invalid")
	ErrInvalidCopyFrom        = errors.New("copy from is invalid")
	ErrMapKeyNotMatch         = errors.New("map's key type doesn't match")
	ErrNotSupported           = errors.New("not supported")
)

Functions

func CloseQuietly

func CloseQuietly(closer io.Closer)

CloseQuietly 关闭io, 忽略错误

func Copy added in v1.1.9

func Copy(toValue interface{}, fromValue interface{}) (err error)

Copy copy things

func CopyWithOption added in v1.1.9

func CopyWithOption(toValue interface{}, fromValue interface{}, opt Option) (err error)

CopyWithOption copy with option

func ParseFloat

func ParseFloat(s string) float64

func ParseInt added in v1.1.5

func ParseInt(s string) int64

func ParseUint

func ParseUint(s string) uint64

func ToString

func ToString(value interface{}) string

ToString converts a value to string.

Types

type Option added in v1.1.9

type Option struct {
	// setting this value to true will ignore copying zero values of all the fields, including bools, as well as a
	// struct having all it's fields set to their zero values respectively (see IsZero() in reflect/value.go)
	IgnoreEmpty bool
	DeepCopy    bool
}

Option sets copy options

Jump to

Keyboard shortcuts

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