utils

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func First

func First[T interface{}](defaultArg T, args []T) T

获取可变参数第一个参数

func GetBoolValue

func GetBoolValue(m map[string]interface{}, key string) (bool, bool)

func GetFloatValue

func GetFloatValue(m map[string]interface{}, key string) (float64, bool)

func GetIntValue

func GetIntValue(m map[string]interface{}, key string) (int, bool)

func GetInterfaceSlice

func GetInterfaceSlice(m map[string]interface{}, key string) ([]interface{}, bool)

func GetStringSlice

func GetStringSlice(m map[string]interface{}, key string) ([]string, bool)

func GetStringValue

func GetStringValue(m map[string]interface{}, key string) (string, bool)

func HttpDelete

func HttpDelete(url string, params interface{}, headers ...map[string]string) ([]byte, error)

func HttpDeleteWithToken

func HttpDeleteWithToken(url string, params interface{}, token string, headers ...map[string]string) ([]byte, error)

func HttpGet

func HttpGet(url string, params map[string]string, headers ...map[string]string) ([]byte, error)

func HttpGetWithToken

func HttpGetWithToken(url string, params map[string]string, token string, headers ...map[string]string) ([]byte, error)

func HttpPost

func HttpPost[T interface{} | map[string]interface{}](url string, params interface{}, headers ...map[string]string) (T, error)

func HttpPostByte

func HttpPostByte(url string, params interface{}, headers ...map[string]string) ([]byte, error)

func HttpPostByteWithToken

func HttpPostByteWithToken(url string, params interface{}, token string, headers ...map[string]string) ([]byte, error)

func HttpPostWithToken

func HttpPostWithToken[T interface{} | map[string]interface{}](url string, params interface{}, token string, headers ...map[string]string) (T, error)

func HttpPut

func HttpPut(url string, params interface{}, headers ...map[string]string) ([]byte, error)

func HttpPutWithToken

func HttpPutWithToken(url string, params interface{}, token string, headers ...map[string]string) ([]byte, error)

func JsonParse

func JsonParse[T interface{}](data []byte) (T, error)

Json解析

func JsonString

func JsonString(data interface{}) string

Json序列化

func Max

func Max[T float32 | float64 | int | int32 | int64](a, b T) T

func Min

func Min[T float32 | float64 | int | int32 | int64](a, b T) T

func RandString

func RandString(n int) string

func UUID

func UUID() string

Types

This section is empty.

Directories

Path Synopsis
client

Jump to

Keyboard shortcuts

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