xutils

package
v1.22.7 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	X_PI   = math.Pi * 3000.0 / 180.0
	OFFSET = 0.00669342162296594323
	AXIS   = 6378245.0
)

Variables

This section is empty.

Functions

func BD09toGCJ02

func BD09toGCJ02(lon, lat float64) (float64, float64)

BD09toGCJ02 百度坐标系->火星坐标系

func BD09toWGS84

func BD09toWGS84(lon, lat float64) (float64, float64)

BD09toWGS84 百度坐标系->WGS84坐标系

func Base64Decode

func Base64Decode(str string) (string, error)

func Base64Encode

func Base64Encode(str string) string

func Bytes2Mac

func Bytes2Mac(b []byte) string

func BytesToInt

func BytesToInt(b []byte) int64

func CamelCase added in v1.22.7

func CamelCase(name string) string

func ClientIp

func ClientIp(r *http.Request) string

func Crc32

func Crc32(str string) uint32

Crc32 crc32()

func CurrentAbPath

func CurrentAbPath() string

CurrentAbPath 获取当前程序运行的绝对路径 兼容go run

func FileExists

func FileExists(filename string) bool

FileExists file_exists()

func FormatStrJson

func FormatStrJson(b []byte) []byte

func GCJ02toBD09

func GCJ02toBD09(lon, lat float64) (float64, float64)

GCJ02toBD09 火星坐标系->百度坐标系

func GCJ02toWGS84

func GCJ02toWGS84(lon, lat float64) (float64, float64)

GCJ02toWGS84 火星坐标系->WGS84坐标系

func GetDistance

func GetDistance(lng1, lat1, lng2, lat2 float64) float64

GetDistance 计算两个经纬度之间的距离, 参考链接:https://blog.csdn.net/gatieme/article/details/45599581 在线经纬度换算:https://tools.fun/distance.html 返回单位为:米

func IntToBytes

func IntToBytes(i interface{}) []byte

func InternalIp

func InternalIp(in string) bool

InternalIp 判断是不是内网IP,仅支持IPv4

func Ip2Location

func Ip2Location(in string) string

func IsBuildRun

func IsBuildRun() bool

IsBuildRun 判断是否是build编译的文件

func IsJson

func IsJson(b []byte) bool

func IsLocalIp added in v1.20.5

func IsLocalIp(ip string) bool

IsLocalIp 判断是否是本机ip

func Md5

func Md5(str string) string

Md5 md5()

func Md5File

func Md5File(path string) (string, error)

Md5File md5_file()

func ParseMac

func ParseMac(mac string) []byte

func ParseTag

func ParseTag(tag string) map[string]any

func PasswordHash

func PasswordHash(password string) (string, error)

func PasswordVerify

func PasswordVerify(password, hash string) bool

func RandFloat

func RandFloat(min, max float64) float64

func RandInt

func RandInt(min, max int64) int64

func RandStr

func RandStr(length int) string

func RecoverGo

func RecoverGo(f func(), recoverHandler func(err interface{}))

func RedisLocker added in v1.22.1

func RedisLocker(client *xredis.Client, key string, retries int, interval, expiration time.Duration) *xredis.RedisLocker

func Request

func Request(r *http.Request) url.Values

func Round

func Round(val float64, p int32) float64

func ServerIP

func ServerIP() (ip net.IP)

func ServerMac

func ServerMac() string

ServerMac 获取本机的MAC地址

func Sha1

func Sha1(str string) string

Sha1 sha1()

func Sha1File

func Sha1File(path string) (string, error)

Sha1File sha1_file()

func StrArrayEmpty

func StrArrayEmpty(arr []string) bool

func UniqueInt64

func UniqueInt64(data []int64) []int64

func WGS84toBD09

func WGS84toBD09(lon, lat float64) (float64, float64)

WGS84toBD09 WGS84坐标系->百度坐标系

func WGS84toGCJ02

func WGS84toGCJ02(lon, lat float64) (float64, float64)

WGS84toGCJ02 WGS84坐标系->火星坐标系

Types

This section is empty.

Jump to

Keyboard shortcuts

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