util

package
v0.0.0-...-256bcdb Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	DefaultShortStrMax = 1023
)

Functions

func If

func If(condition bool, valIfTrue, valIfFalse interface{}) interface{}

func IfEmptyBoolSlice

func IfEmptyBoolSlice(val []bool, valIfEmpty bool) bool

func IfEmptyInt

func IfEmptyInt(val, valIfEmpty int) int

func IfEmptyInt32

func IfEmptyInt32(val, valIfEmpty int32) int32

func IfEmptyInt32Slice

func IfEmptyInt32Slice(val []int32, valIfEmpty int32) int32

func IfEmptyInt64

func IfEmptyInt64(val, valIfEmpty int64) int64

func IfEmptyInt64Slice

func IfEmptyInt64Slice(val []int64, valIfEmpty int64) int64

func IfEmptyIntSlice

func IfEmptyIntSlice(val []int, valIfEmpty int) int

func IfEmptySlice

func IfEmptySlice(val []interface{}, valIfEmpty interface{}) interface{}

func IfEmptyString

func IfEmptyString(val, valIfEmpty string) string

func IfEmptyStringSlice

func IfEmptyStringSlice(val []string, valIfEmpty string) string

func IfFloat

func IfFloat(condition bool, valIfTrue, valIfFalse float64) float64

func IfInt

func IfInt(condition bool, valIfTrue, valIfFalse int) int

func IfInt32

func IfInt32(condition bool, valIfTrue, valIfFalse int32) int32

func IfInt64

func IfInt64(condition bool, valIfTrue, valIfFalse int64) int64

func IfNotEmptyInt

func IfNotEmptyInt(val, valIfNotEmpty int) int

func IfNotEmptyInt32

func IfNotEmptyInt32(val, valIfNotEmpty int32) int32

func IfNotEmptyInt64

func IfNotEmptyInt64(val, valIfNotEmpty int64) int64

func IfNotEmptyString

func IfNotEmptyString(val, valIfNotEmpty string) string

func IfString

func IfString(condition bool, valIfTrue, valIfFalse string) string

func IfUser

func IfUser(condition bool, valIfTrue, valIfFalse func() interface{}) interface{}

func IfUserEmptyInt

func IfUserEmptyInt(val int, valIfEmpty func() int) int

func IfUserEmptyInt32

func IfUserEmptyInt32(val int32, valIfEmpty func() int32) int32

func IfUserEmptyInt64

func IfUserEmptyInt64(val int64, valIfEmpty func() int64) int64

func IfUserEmptyString

func IfUserEmptyString(val string, valIfEmpty func() string) string

func IfUserFloat

func IfUserFloat(condition bool, valIfTrue, valIfFalse func() float64) float64

func IfUserInt

func IfUserInt(condition bool, valIfTrue, valIfFalse func() int) int

func IfUserInt32

func IfUserInt32(condition bool, valIfTrue, valIfFalse func() int32) int32

func IfUserInt64

func IfUserInt64(condition bool, valIfTrue, valIfFalse func() int64) int64

func IfUserString

func IfUserString(condition bool, valIfTrue, valIfFalse func() string) string

func PrintArgsLn

func PrintArgsLn(a ...interface{})

func PrintErrArgsLn

func PrintErrArgsLn(a ...interface{})

func PrintErrLongTimeLn

func PrintErrLongTimeLn(format string, a ...interface{})

func PrintErrTimeLn

func PrintErrTimeLn(format string, a ...interface{})

func PrintErrln

func PrintErrln(format string, a ...interface{})

func PrintTimeLn

func PrintTimeLn(format string, a ...interface{})

func Println

func Println(format string, a ...interface{})

func ShortStr

func ShortStr(str string, max ...int) string

ShortStr 长字符串截断、只保留前面的一部分,其余部分用 “...(%d more)” 代替。

Example
for _, s := range []string{
	"aaa",
	"aaa aaa",
	"aaa aaa aaa",
} {
	Println(ShortStr(s, 5))
}
Output:

aaa
aaa a...(2 more)
aaa a...(6 more)

Types

This section is empty.

Directories

Path Synopsis
------------------------------------------------------------------------------ 用于比较两个对象的函数集。
------------------------------------------------------------------------------ 用于比较两个对象的函数集。
------------------------------------------------------------------------------ 类型转换函数集 ------------------------------------------------------------------------------
------------------------------------------------------------------------------ 类型转换函数集 ------------------------------------------------------------------------------
------------------------------------------------------------------------------ 对 jsonIter 的进一步封装
------------------------------------------------------------------------------ 对 jsonIter 的进一步封装

Jump to

Keyboard shortcuts

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