common

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(src interface{}) interface{}

Clone 浅克隆,可以克隆任意数据类型,对指针类型子元素无法克隆 获取类型:如果类型是指针类型,需要使用Elem()获取对象实际类型 获取实际值:如果值是指针类型,需要使用Elem()获取实际数据 说白了,Elem()就是获取反射数据的实际类型和实际值

func DeepClone

func DeepClone(src interface{}) interface{}

DeepClone 深度克隆,可以克隆任意数据类型

func DeepCopy

func DeepCopy(dst, src interface{}) error

DeepCopy 深度拷贝

func GenRandomStr

func GenRandomStr(length int) string

func GenSalt

func GenSalt(length int) string

func GetFreePort added in v0.1.17

func GetFreePort() (int, error)

func GetLocalIp

func GetLocalIp() string

GetLocalIp 获取本机IP

func GetLocalPriorityIp

func GetLocalPriorityIp(priorityNetWork []string) string

GetLocalPriorityIp 获取本机IP(根据规则优先选取IP)

func GetTypeByContentType

func GetTypeByContentType(contentType string) string

func RemoteIp

func RemoteIp(req *http.Request) string

func StructToMap

func StructToMap(obj interface{}, tagName string) map[string]interface{}

Types

This section is empty.

Jump to

Keyboard shortcuts

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