Documentation ¶
Index ¶
- Constants
- func Base642Image(image string) (img image.Image, picType string, err error)
- func BuildsSort(s string) string
- func ConvertToString(src string, srcCode string, tagCode string) string
- func DoWritLogFile(data interface{}, msg string, symbol string, lf *os.File)
- func GetDateTimeFormat(t time.Time) string
- func GetFileSize(file *os.File) (s int64)
- func GetI18NValue(s, lang string) (result string, err error)
- func GetImageSize(file *os.File) (width, height int)
- func GetOrientation(f *os.File) (val int, e error)
- func GetULID() ulid.ULID
- func GetULID2Str() string
- func GetULIDV4() UUID.UUID
- func Get_two_points_distance(oldLL Longlati, newLL Longlati) int
- func IsOrientationZero(f *os.File) (b bool, e error)
- func Jpg2Base64(filename string) (base64Str string, err error)
- func RemoveDuplicatesAndEmpty(a []string) (ret []string)
- func SliceIndex(a Element, i interface{}) int
- func Substr(str string, start, length int) string
- func SunnyCompareTime(t, u time.Time, symbol string) (b bool)
- func SunnyIsNotExist(path string)
- func SunnyIsNotExists(path string)
- func SunnyJSONToStr(jsondata interface{}) (result string)
- func SunnyMd5(str string) (keyMd5 string)
- func SunnyParseDuration(strSpan string, t time.Time) time.Time
- func SunnyStr2Time(strTime string) time.Time
- func SunnyStr2USATime(strTime string) (time.Time, error)
- func SunnyStrJoin(str ...string) string
- func SunnyTimeNow(style string) (result string)
- func SunnyTimeToStr(t time.Time, style string) (result string)
- func SunnyTypeof(v interface{}) string
- type Element
- type Longlati
- type SafeCounter
- type SunnyMsgStruct
Constants ¶
const EARTH_RADIUS = 6371000
Variables ¶
This section is empty.
Functions ¶
func Base642Image ¶
Base642Image base64 to Image 目前支持png、jpeg
func BuildsSort ¶
buildsSort 对buildings进行排序 Example: `{'123','456','234','567','345'}` 排序以后变为
{'123','234','345','456','567'}
func ConvertToString ¶
ConvertToString ... gbk装换成utf8 str := "乱码的字符串变量" str = ConvertToString(str, "gbk", "utf-8")
func DoWritLogFile ¶
doWritLogFile 写日志
func GetFileSize ¶
GetFileSize 取得文件大小 @Param file *os.File 文件句柄 @Return s int64
func GetI18NValue ¶
GetI18NValue 取得I18N的值 str := GetI18NValue(`{"zh-CN":"添加成功!","en-US":"Added successfully.","zh-TW":"添加成功!"} `,`en-US`)
func GetImageSize ¶
GetImageSize 取得图片尺寸 @Param file *os.File 文件句柄 @Return width,height int
func GetOrientation ¶
//旋转角度 参数 //0° 1 //顺时针90° 6 //逆时针90° 8 //180° 3
GetOrientation 取得照片旋转的方向 @Param f *os.File 图片文件句柄 @Return b bool, e error
func IsOrientationZero ¶
IsOrientationZero 是否是正向的照片 @Param f *os.File 图片文件句柄 @Return b bool, e error
func RemoveDuplicatesAndEmpty ¶
RemoveDuplicatesAndEmpty 排重函数
func SliceIndex ¶
SliceIndex 类似python的list.index()方法,找出slice里面是否包含查询的参数 返回值是-1表示没有搜索到。
func SunnyCompareTime ¶
SunnyCompareTime 比较时间戳大小 @Param t,u time.Time需要比较的时间 @Param symbol string 标志包括 lt gt eq
func SunnyJSONToStr ¶
func SunnyJSONToStr(jsondata interface{}) (result string)
SunnyJSONToStr 把json变成字符串
func SunnyParseDuration ¶
SunnyParseDuration 输入字符串返回增加或者减少的时间,1m是增加一分钟,-1m是减少一分钟 @Param strSpan string,t time.Time @Return time.Time
func SunnyStr2Time ¶
SunnyStr2Time 输入字符串返回时间 待转化为时间戳的字符串 注意 这里的小时和分钟还要秒必须写 因为是跟着模板走的 修改模板的话也可以不写 @Param strTime string @Return time.Time
func SunnyStr2USATime ¶
SunnyStr2USATime 输入字符串返回UTC时间 待转化为时间戳的字符串 注意 这里的小时和分钟还要秒必须写 因为是跟着模板走的 修改模板的话也可以不写 @Param strTime string @Return time.Time error
func SunnyTimeNow ¶
SunnyTimeNow 返回格式化好的当前字符串 style 是day返回年月日,是time返回2006-01-02 15:04:05
func SunnyTimeToStr ¶
SunnyTimeToStr 把时间类型的转换为字符串
Types ¶
type SafeCounter ¶
SafeCounter is safe to use concurrently.
func (*SafeCounter) Clear ¶
func (c *SafeCounter) Clear(key string)
Value returns the current value of the counter for the given key.
func (*SafeCounter) GetValue ¶
func (c *SafeCounter) GetValue(key string) (string, int)
Value returns the current value of the counter for the given key.
func (*SafeCounter) Inc ¶
func (c *SafeCounter) Inc(key string, s1, str string, b bool)
Inc increments the counter for the given key.
func (*SafeCounter) Value ¶
func (c *SafeCounter) Value(key string) string
Value returns the current value of the counter for the given key.
type SunnyMsgStruct ¶
type SunnyMsgStruct struct { Msg string `json:"msg"` Status bool `json:"status"` Data interface{} `json:"data"` }
SunnyMsgStruct 统一返回的信息结构体