Documentation ¶
Overview ¶
Package util @Author: asus @Description: $ @File: translations @Data: 2021/12/39:36
Index ¶
- Constants
- func BD09toGCJ02(lng, lat float64) (float64, float64)
- func BD09toWGS84(lng, lat float64) (float64, float64)
- func BeijingTime() time.Time
- func CamelCaseString(s string) string
- func ConvertToByte(src *string, srcCode string, targetCode string) []byte
- func CutArrayString(arr []string, per int) [][]string
- func CutArrayUint64(arr []uint64, per int) [][]uint64
- func DayToUnix0000(day string) (int64, error)
- func DayToUnix2359(day string) (int64, error)
- func DayUint64(t *time.Time) (uint64, error)
- func Distance(lng1, lat1, lng2, lat2 float64) float64
- func ExcludeArr(arr []uint64, exclude []uint64) []uint64
- func FloatToInt(v float64) int
- func FloatToStr(v float64) string
- func GCJ02toBD09(lng, lat float64) (float64, float64)
- func GCJ02toWGS84(lng, lat float64) (float64, float64)
- func GetMonth(t *time.Time) int
- func GetYmdInt(t *time.Time) (int, int, int)
- func InArrayByte(elem byte, arr []byte) bool
- func InArrayInt(elem int, arr []int) bool
- func InArrayString(elem string, arr []string) bool
- func InArrayUint64(elem uint64, arr []uint64) bool
- func InArrayUint8(elem uint8, arr []uint8) bool
- func Int64ToStr(v int64) string
- func IntToFloat(v int) float64
- func IntToStr(v int) string
- func IsInPolygon(x, y float64, area [][2]float64) bool
- func IsInPolygonRough(x, y float64, area [][2]float64, deviation float64) bool
- func IsMobile(str string) bool
- func JsonDecode(s []byte, data interface{}) (err error)
- func JsonEncode(data interface{}) (marshal []byte, err error)
- func JsonIter() jsoniter.API
- func RandomInt(length int) int
- func RandomNumber(length int) string
- func RandomStr(length int) string
- func ReflectToApiSignData(p interface{}) (res []string)
- func ReflectToMap(m interface{}, filter []string) map[string]interface{}
- func Replace(str *string, old string, new string) string
- func Round(f float64) float64
- func Round6(f float64) float64
- func SnakeString(s string) string
- func Split(str *string, sep string) []string
- func StrCut(str string, length int) string
- func StrCutDirect(str string, length int) string
- func StrIndex(str *string, subStr string) int
- func StrLL(str *string, subStr string) string
- func StrLR(str *string, subStr string) string
- func StrRL(str *string, subStr string) string
- func StrRR(str *string, subStr string) string
- func StrToFloat(v string) (float64, error)
- func StrToInt(v string) (int, error)
- func StrToInt64(v string) (int64, error)
- func StrToUint64(v string) (uint64, error)
- func StrToUint8(v string) (uint8, error)
- func Strval(value interface{}) string
- func Substr(str *string, start int, length ...int) string
- func TimeDataToString(t int64) string
- func TimeMPeriod(timestamp int64) (start, end uint32)
- func TimeToString(t int64) string
- func TimeToY(timestamp int64) string
- func TimeToYm(timestamp int64) string
- func TimeTom(timestamp int64) string
- func TimeUnix() uint32
- func TimeYPeriod(timestamp int64) (start, middle, end uint32)
- func TimeYmdNow() string
- func TimeYmd_Now2() string
- func ToJsonString(v interface{}) (string, error)
- func Trim(s string) string
- func Uint64ToStr(v uint64) string
- func Uint8ToStr(v uint8) string
- func UniqueArrayInt(arr []int) []int
- func UniqueArrayString(arr []string) []string
- func UniqueArrayUint64(arr []uint64) []uint64
- func UniqueArrayUint8(arr []uint8) []uint8
- func UrlEncode(value string) string
- func Uuid() string
- func WGS84toBD09(lng, lat float64) (float64, float64)
- func WGS84toGCJ02(lng, lat float64) (float64, float64)
- type Option
- type RegisterTrans
- type SortAscInt
- type SortAscStringInt
- type SortAscStringIntArr
- type SortAscStringString
- type SortAscStringStringArr
- type SortAscUint
- type SortAscUint64Int
- type SortAscUint64Int64
- type SortAscUint64Int64Arr
- type SortAscUint64IntArr
- type SortAscUint64String
- type SortAscUint64StringArr
- type SortDescInt
- type SortDescStringInt
- type SortDescStringIntArr
- type SortDescStringString
- type SortDescStringStringArr
- type SortDescUint
- type SortDescUint64Int
- type SortDescUint64IntArr
- type SortDescUint64String
- type SortDescUint64StringArr
- type Translations
Constants ¶
const ( PI = math.Pi * 3000.0 / 180.0 OFFSET = 0.00669342162296594323 AXIS = 6378245.0 )
const ( DateFormat = "2006-01-02 15:04:05" DayFormatFile = "2006_01_02" DayFormat = "2006-01-02" DayIntFormat = "20060102" DayFormatYmdH = "2006-01-02-15" )
Variables ¶
This section is empty.
Functions ¶
func BD09toWGS84 ¶
BD09toWGS84 百度坐标系->WGS84坐标系
func BeijingTime ¶
func CamelCaseString ¶
func CutArrayString ¶
*
- 大数组分割成多个小数组 - 用于批量处理数据的时候,防止SQL参数过大
- @param arr 大数组
- @param per 每个小数组的长度
- @return 小数组
func CutArrayUint64 ¶
*
- 大数组分割成多个小数组 - 用于批量处理数据的时候,防止SQL参数过大
- @param arr 大数组
- @param per 每个小数组的长度
- @return 小数组
func DayToUnix0000 ¶
func DayToUnix2359 ¶
func FloatToInt ¶
func FloatToStr ¶
func GCJ02toWGS84 ¶
GCJ02toWGS84 火星坐标系->WGS84坐标系
func InArrayString ¶
func Int64ToStr ¶
func IntToFloat ¶
func IsInPolygon ¶
* 目标:精确判断某个点是否在多边形内 * 理论依据:目标点向右延伸,得出和多边形有几个交叉点(临界值判定规则:交叉点两端必须在射线两侧,判断依据:y1<y且y2>=y) * 如果是奇数 => 点在多边形内 * 否则为偶数 => 点在多边形外
func RandomNumber ¶
func ReflectToApiSignData ¶
func ReflectToApiSignData(p interface{}) (res []string)
将传入的变量转换成接口签名校验需要的格式
func ReflectToMap ¶
将传入的变量转换成 - map[string]interface{}
func SnakeString ¶
func StrCutDirect ¶
func StrToFloat ¶
func StrToInt64 ¶
func StrToUint64 ¶
func StrToUint8 ¶
func TimeDataToString ¶
func TimeToString ¶
func TimeYmdNow ¶
func TimeYmdNow() string
func TimeYmd_Now2 ¶
func TimeYmd_Now2() string
func ToJsonString ¶
func Uint64ToStr ¶
func Uint8ToStr ¶
func WGS84toBD09 ¶
WGS84toBD09 WGS84坐标系->百度坐标系
func WGS84toGCJ02 ¶
WGS84toGCJ02 WGS84坐标系->火星坐标系
Types ¶
type Option ¶ added in v0.1.4
type Option interface {
// contains filtered or unexported methods
}
func WithLabelOption ¶ added in v0.1.4
WithLabelOption 字段转换成中文标签
func WithRulesMsgOption ¶ added in v0.1.4
func WithRulesMsgOption(rulesMsg *map[string]RegisterTrans) Option
WithRulesMsgOption 注册自定义错误信息
func WithRulesOption ¶ added in v0.1.4
WithRulesOption 注册自定义验证方法
type RegisterTrans ¶ added in v0.1.4
type RegisterTrans struct { RegisterTranslationsFunc validator.RegisterTranslationsFunc TranslationFunc validator.TranslationFunc }
type SortAscInt ¶
type SortAscInt []int
=============================== int/正序 ===============================
func (SortAscInt) Len ¶
func (s SortAscInt) Len() int
func (SortAscInt) Less ¶
func (s SortAscInt) Less(i, j int) bool
func (SortAscInt) Swap ¶
func (s SortAscInt) Swap(i, j int)
type SortAscStringInt ¶
=============================== string_int/正序 ===============================
type SortAscStringIntArr ¶
type SortAscStringIntArr []SortAscStringInt
func (SortAscStringIntArr) Len ¶
func (s SortAscStringIntArr) Len() int
func (SortAscStringIntArr) Less ¶
func (s SortAscStringIntArr) Less(i, j int) bool
func (SortAscStringIntArr) Swap ¶
func (s SortAscStringIntArr) Swap(i, j int)
type SortAscStringString ¶
=============================== string_string/正序 ===============================
type SortAscStringStringArr ¶
type SortAscStringStringArr []SortAscStringString
func (SortAscStringStringArr) Len ¶
func (s SortAscStringStringArr) Len() int
func (SortAscStringStringArr) Less ¶
func (s SortAscStringStringArr) Less(i, j int) bool
func (SortAscStringStringArr) Swap ¶
func (s SortAscStringStringArr) Swap(i, j int)
type SortAscUint ¶
type SortAscUint []uint64
=============================== uint64/正序 ===============================
func (SortAscUint) Len ¶
func (s SortAscUint) Len() int
func (SortAscUint) Less ¶
func (s SortAscUint) Less(i, j int) bool
func (SortAscUint) Swap ¶
func (s SortAscUint) Swap(i, j int)
type SortAscUint64Int ¶
=============================== uint64_int/正序 ===============================
type SortAscUint64Int64 ¶
=============================== uint64_int64/正序 ===============================
type SortAscUint64Int64Arr ¶
type SortAscUint64Int64Arr []SortAscUint64Int64
func (SortAscUint64Int64Arr) Len ¶
func (s SortAscUint64Int64Arr) Len() int
func (SortAscUint64Int64Arr) Less ¶
func (s SortAscUint64Int64Arr) Less(i, j int) bool
func (SortAscUint64Int64Arr) Swap ¶
func (s SortAscUint64Int64Arr) Swap(i, j int)
type SortAscUint64IntArr ¶
type SortAscUint64IntArr []SortAscUint64Int
func (SortAscUint64IntArr) Len ¶
func (s SortAscUint64IntArr) Len() int
func (SortAscUint64IntArr) Less ¶
func (s SortAscUint64IntArr) Less(i, j int) bool
func (SortAscUint64IntArr) Swap ¶
func (s SortAscUint64IntArr) Swap(i, j int)
type SortAscUint64String ¶
=============================== uint64_string/正序 ===============================
type SortAscUint64StringArr ¶
type SortAscUint64StringArr []SortAscUint64String
func (SortAscUint64StringArr) Len ¶
func (s SortAscUint64StringArr) Len() int
func (SortAscUint64StringArr) Less ¶
func (s SortAscUint64StringArr) Less(i, j int) bool
func (SortAscUint64StringArr) Swap ¶
func (s SortAscUint64StringArr) Swap(i, j int)
type SortDescInt ¶
type SortDescInt []int
=============================== int/倒序 ===============================
func (SortDescInt) Len ¶
func (s SortDescInt) Len() int
func (SortDescInt) Less ¶
func (s SortDescInt) Less(i, j int) bool
func (SortDescInt) Swap ¶
func (s SortDescInt) Swap(i, j int)
type SortDescStringInt ¶
=============================== string_int/倒序 ===============================
type SortDescStringIntArr ¶
type SortDescStringIntArr []SortDescStringInt
func (SortDescStringIntArr) Len ¶
func (s SortDescStringIntArr) Len() int
func (SortDescStringIntArr) Less ¶
func (s SortDescStringIntArr) Less(i, j int) bool
func (SortDescStringIntArr) Swap ¶
func (s SortDescStringIntArr) Swap(i, j int)
type SortDescStringString ¶
=============================== string_string/倒序 ===============================
type SortDescStringStringArr ¶
type SortDescStringStringArr []SortDescStringString
func (SortDescStringStringArr) Len ¶
func (s SortDescStringStringArr) Len() int
func (SortDescStringStringArr) Less ¶
func (s SortDescStringStringArr) Less(i, j int) bool
func (SortDescStringStringArr) Swap ¶
func (s SortDescStringStringArr) Swap(i, j int)
type SortDescUint ¶
type SortDescUint []uint64
=============================== uint64/倒序 ===============================
func (SortDescUint) Len ¶
func (s SortDescUint) Len() int
func (SortDescUint) Less ¶
func (s SortDescUint) Less(i, j int) bool
func (SortDescUint) Swap ¶
func (s SortDescUint) Swap(i, j int)
type SortDescUint64Int ¶
=============================== uint64_int/倒序 ===============================
type SortDescUint64IntArr ¶
type SortDescUint64IntArr []SortDescUint64Int
func (SortDescUint64IntArr) Len ¶
func (s SortDescUint64IntArr) Len() int
func (SortDescUint64IntArr) Less ¶
func (s SortDescUint64IntArr) Less(i, j int) bool
func (SortDescUint64IntArr) Swap ¶
func (s SortDescUint64IntArr) Swap(i, j int)
type SortDescUint64String ¶
=============================== uint64_string/倒序 ===============================
type SortDescUint64StringArr ¶
type SortDescUint64StringArr []SortDescUint64String
func (SortDescUint64StringArr) Len ¶
func (s SortDescUint64StringArr) Len() int
func (SortDescUint64StringArr) Less ¶
func (s SortDescUint64StringArr) Less(i, j int) bool
func (SortDescUint64StringArr) Swap ¶
func (s SortDescUint64StringArr) Swap(i, j int)
type Translations ¶ added in v0.1.4
type Translations struct {
// contains filtered or unexported fields
}
func NewTranslationIns ¶ added in v0.1.4
func NewTranslationIns(options ...Option) *Translations
GetTranslationIns 返回参数验证的实列
func (*Translations) SetTrans ¶ added in v0.1.4
func (translations *Translations) SetTrans()
SetTrans 中文翻译
func (*Translations) ValidateParam ¶ added in v0.1.4
func (translations *Translations) ValidateParam(data interface{}) (errRes error)
ValidateParam 校验参数