Documentation ¶
Index ¶
- Variables
- func AESDecrypt(key string, iv string, data string) string
- func AESEncrypt(key string, iv string, data string) string
- func ArrayContains[T any](array []T, value T) bool
- func ArrayEmpty[T any]() []T
- func FormatChinaMoney(value int64) string
- func FormatChinaMoneyWord(num float64) string
- func FormatDate(dt time.Time) string
- func FormatDateTime(dt time.Time) string
- func FormatDateTimeLayout(dt time.Time, layout string) string
- func FormatKilometer(value int64, scale uint8) string
- func FormatTime(dt time.Time) string
- func GeoCheckInAreas(point GeoPoint, areas []GeoPoint) bool
- func GeoHashEncode(longitude float64, latitude float64, precision int) string
- func GeoHashGetNeighbors(latitude, longitude float64, precision int) []string
- func GetGoroutineID() uint64
- func GetLastTime(t time.Time) time.Time
- func GetMonthFirstDay(t time.Time) time.Time
- func GetMonthLastDay(t time.Time) time.Time
- func GetWeekdayOfDay(t time.Time, weekday time.Weekday) time.Time
- func GetZeroTime(t time.Time) time.Time
- func HttpGet(requestUrl string) (bool, string, int)
- func HttpPostForm(requestUrl string, data url.Values) (bool, string, int)
- func HttpPostJson(requestUrl string, json string) (bool, string, int)
- func HttpPostJsonDownload(requestUrl string, json string) (bool, string, *os.File, int)
- func HttpPostJsonWithHeader(requestUrl string, json string, headers map[string]string) (bool, string, int)
- func HttpPostXmlSecure(requestUrl string, xml string, certFile string, keyFile string, ...) (bool, string, int)
- func JsonToString(value any) string
- func MD5String(plain string) string
- func MapContainsKey(key string, m map[string]any) bool
- func MapEmpty[T any]() map[string]T
- func MapKeys(m map[string]any) []string
- func MaskIDCardNo(idno string) string
- func MaskMobile(mobile string) string
- func ParseDate(value string) time.Time
- func ParseDateTime(value string) time.Time
- func ParseDateTimeLayout(value string, layout string) time.Time
- func ParseLocation(value string) (float64, float64)
- func ParseTime(value string) time.Time
- func RandomInt(minimum int64, maximum int64) int64
- func RandomString(count int, letters bool, numbers bool) string
- func RatioCalcGrowthRate(last float64, now float64) float64
- func RatioCalcPercent(total float64, val float64) float64
- func SHA1String(plain string) string
- func SHA256String(plain string) string
- func SHA512String(plain string) string
- func SliceContains[T any](slice []T, value T) bool
- func SliceEmpty[T any]() []T
- func SliceIndex[T any](slice []T, value T) int
- func SliceInsert[T any](slice []T, index int, value T) []T
- func SnowfIDWorker(workerId, startTime int64) *snowfIDWorker
- func StringDefaultIfBlank(value, defaultString string) string
- func StringIsAllBlank(value ...string) bool
- func StringIsAnyBlank(value ...string) bool
- func StringIsBlank(value string) bool
- func StringIsNotBlank(value string) bool
- func StringLeftPad(value string, size int, padString string) string
- func StringReverse(value string) string
- func StringRightPad(value string, size int, padString string) string
- func Ternary[T any](expr bool, first T, second T) T
- func ToBool(value any) bool
- func ToFloat32(value any) float32
- func ToFloat64(value any) float64
- func ToInt(value any) int
- func ToInt16(value any) int16
- func ToInt32(value any) int32
- func ToInt64(value any) int64
- func ToInt8(value any) int8
- func ToString(value any) string
- func ToUInt(value any) uint
- func ToUInt16(value any) uint16
- func ToUInt32(value any) uint32
- func ToUInt64(value any) uint64
- func ToUInt8(value any) uint8
- func XMLFromMap(m map[string]string, root string) string
- func XMLToMap(s string) map[string]string
- type GeoPoint
- type JsonNode
- func (n *JsonNode) Boolean() bool
- func (n *JsonNode) ContainsKey(key string) bool
- func (n *JsonNode) Float64() float64
- func (n *JsonNode) Index(index int) *JsonNode
- func (n *JsonNode) Int64() int64
- func (n *JsonNode) IsArray() bool
- func (n *JsonNode) IsEmpty() bool
- func (n *JsonNode) IsObject() bool
- func (n *JsonNode) Keys() []string
- func (n *JsonNode) Name(key string) *JsonNode
- func (n *JsonNode) Size() int
- func (n *JsonNode) String() string
- func (n *JsonNode) ToArray() []any
- func (n *JsonNode) ToMap() map[string]any
- func (n *JsonNode) ToSlice() []map[string]any
Constants ¶
This section is empty.
Variables ¶
var ( RegexpNumeric = regexp.MustCompile(regexpNumeric) // 数字格式 RegexpChinaID = regexp.MustCompile(regxpChinaID) // 中国身份证号 RegexpChinaMobile = regexp.MustCompile(regxpChinaMobile) // 中国11位手机号 RegexpChinaCarNO = regexp.MustCompile(regxpChinaCarNO) // 中国车牌号 )
Functions ¶
func AESDecrypt ¶
AESDecrypt AES 解密内容 AES-128/CBC/PKCS5Padding ,key:32,iv:16
func AESEncrypt ¶
AESEncrypt AES 加密内容 AES-128/CBC/PKCS5Padding ,key:32,iv:16
func ArrayContains ¶
ArrayContains 检查指定元素是否包含在 array 内
func FormatChinaMoneyWord ¶ added in v1.0.5
FormatChinaMoneyWord 格式化人民币大写格式
func FormatDateTime ¶
FormatDateTime 格式化时间为 2006-01-02 15:04:05 格式
func FormatDateTimeLayout ¶ added in v1.0.5
FormatDateTimeLayout 格式化指定格式的字符串
func FormatKilometer ¶
FormatKilometer 格式化公里,从米到千米
func GeoCheckInAreas ¶ added in v1.0.5
GeoCheckInAreas 检查指定点是否在区域内
func GeoHashEncode ¶ added in v1.0.3
GeoHashEncode 输入值:纬度,经度,精度(geohash的长度)
func GeoHashGetNeighbors ¶ added in v1.0.3
GeoHashGetNeighbors 计算该点(latitude, longitude)在精度precision下的邻居 -- 周围8个区域+本身所在区域 返回这些区域的geohash值,总共9个
func GetLastTime ¶ added in v1.0.2
GetLastTime 获取指定时间最后时刻 23:59:59
func GetMonthFirstDay ¶ added in v1.0.9
GetMonthFirstDay 获取指定日期的当月首日
func GetMonthLastDay ¶ added in v1.0.9
GetMonthLastDay 获取指定日期的当月最后一日
func GetWeekdayOfDay ¶ added in v1.0.8
GetWeekdayOfDay 获取指定日期本周周几的日期
func HttpPostForm ¶ added in v1.0.1
HttpPostForm 执行Post Form 请求
func HttpPostJson ¶ added in v1.0.1
HttpPostJson 执行Post JSON请求
func HttpPostJsonDownload ¶ added in v1.0.9
HttpPostJsonDownload 执行Post JSON请求并获取响应文件
func HttpPostJsonWithHeader ¶ added in v1.0.1
func HttpPostJsonWithHeader(requestUrl string, json string, headers map[string]string) (bool, string, int)
HttpPostJsonWithHeader 执行Post JSON请求
func HttpPostXmlSecure ¶ added in v1.0.1
func HttpPostXmlSecure(requestUrl string, xml string, certFile string, keyFile string, rootCaFile string) (bool, string, int)
HttpPostXmlSecure 执行Post XML 证书请求
func ParseDateTime ¶
ParseDateTime 转换 2006-01-02 15:04:05 格式时间字符串
func ParseDateTimeLayout ¶
ParseDateTimeLayout 转换 为指定 格式时间字符串
func ParseLocation ¶
ParseLocation 转换 lng,lat 格式经纬度字符串,例:113.617525,34.751782
func RandomString ¶
RandomString 生成随机字符
func RatioCalcGrowthRate ¶ added in v1.0.4
RatioCalcGrowthRate 计算环比/同比
func RatioCalcPercent ¶ added in v1.0.4
RatioCalcPercent 计算百分比占比
func SliceContains ¶
SliceContains 检查指定元素是否包含在 slice 内
func SliceIndex ¶ added in v1.0.4
SliceIndex 获取指定元素在slice内的索引
func SnowfIDWorker ¶
func SnowfIDWorker(workerId, startTime int64) *snowfIDWorker
SnowfIDWorker 创建雪花ID实例
func StringDefaultIfBlank ¶ added in v1.0.1
StringDefaultIfBlank 返回字符串,若给定的字符串为空,则返回默认字符串
func StringIsAllBlank ¶
StringIsAllBlank 判断给定的字符串参数中是否全部为空字符串
func StringIsAnyBlank ¶
StringIsAnyBlank 判断给定的字符串参数中是否存在空字符串
func StringIsBlank ¶ added in v1.0.1
StringIsBlank 判断给定的字符串是否为空字符串
func StringIsNotBlank ¶ added in v1.0.1
StringIsNotBlank 判断给定的字符串是否为空字符串
func StringLeftPad ¶ added in v1.0.1
StringLeftPad 左补齐给定字符串
func StringRightPad ¶ added in v1.0.1
StringRightPad 右补齐给定字符串
Types ¶
type GeoPoint ¶ added in v1.0.5
func NewGeoPoint ¶ added in v1.0.5
NewGeoPoint 生成GeoPoint对象
func NewGeoPoints ¶ added in v1.0.5
NewGeoPoints 生成GeoPoint对象数组
type JsonNode ¶
type JsonNode struct {
// contains filtered or unexported fields
}
JsonNode JSON 结构
func JsonFromString ¶
JsonFromString 解析JSON字符串,非法字符以{}或[]返回
func JsonFromStringE ¶
JsonFromStringE 解析JSON字符串数据,并返回解析错误
func (*JsonNode) ContainsKey ¶
ContainsKey 是否包含指定Key