tools

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2021 Murray Inc. All Rights Reserved.

2021/10/08 11:17, by m18527, create ----------------------------------- Go工具类,提供常用的方法

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLegalKey

func BuildLegalKey(args ...interface{}) string

func Camel2Case

func Camel2Case(name string) string

驼峰转下划线

func Case2Camel

func Case2Camel(name string) string

下换线转驼峰

func DoDoneExec

func DoDoneExec(busyMap *sync.Map, key KeyEnum, f func(args ...interface{}), args ...interface{})

func Float64ToInt

func Float64ToInt(f float64, isUpper bool) int

func JsonToList added in v1.0.7

func JsonToList(jsonStr string) []interface{}

func JsonToMap added in v1.0.7

func JsonToMap(jsonStr string) map[string]interface{}

func ObjToStr

func ObjToStr(obj interface{}) (result string)

func ObjToStr_

func ObjToStr_(obj interface{}) (result string, err error)

interfaces{} to json str

func PrintStack

func PrintStack()

func PrintStackWithRecover

func PrintStackWithRecover()

func SafeStr

func SafeStr(str string) string

转换字符串中的特殊字符

func Str2List

func Str2List(listStr string) (result []interface{})

func Str2List_

func Str2List_(listStr string) (result []interface{}, err error)

json str to list

func Str2Map

func Str2Map(jsonStr string) (result map[string]interface{})

func Str2Map_

func Str2Map_(jsonStr string) (result map[string]interface{}, err error)

json str to map

func Timestamp2Time

func Timestamp2Time(second int64) time.Time

timestamp to time

func Timestamp2TimeStr

func Timestamp2TimeStr(second int64) string

timestamp to time string

func ToFloat64

func ToFloat64(obj interface{}) float64

func ToFloat64_

func ToFloat64_(obj interface{}) (float64, error)

obj to float64

func ToInt

func ToInt(str string) int

func ToInt64

func ToInt64(str string) int64

func ToInt64_

func ToInt64_(str string) (int64, error)

string to int64

func ToInt_

func ToInt_(str string) (int, error)

string to int

func ToJson added in v1.0.7

func ToJson(bean interface{}) string

func ToList

func ToList(obj interface{}) []interface{}

转换为对应的数据类型

func ToMap

func ToMap(obj interface{}) map[string]interface{}

转换为对应的数据类型

func ToRound

func ToRound(x, y float64, n int) float64

func ToRound_

func ToRound_(x, y float64, n int) (float64, error)

转换为对应的数据类型, x/y保留n位小数

func ToString

func ToString(obj interface{}) string

obj to string

func ToTimestamp

func ToTimestamp(dateStr string) int64

func ToTimestamp_

func ToTimestamp_(dateStr string) (int64, error)

时间字符串转时间戳

Types

type KeyEnum

type KeyEnum string

type Limit

type Limit struct {
	// contains filtered or unexported fields
}

func NewLimit

func NewLimit(concurrency int) *Limit

func (*Limit) Run

func (limit *Limit) Run(f func(args ...interface{}), wGrp *sync.WaitGroup, args ...interface{})

Jump to

Keyboard shortcuts

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