gomini

package module
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 24 Imported by: 1

README

gomini

go test
go test -v
./gomini.test -test.v
go test -v ./rand_test.go ./rand.go -bench=".*"
go clean -testcache

Documentation

Index

Constants

View Source
const (
	DateTypeYear = iota
	DateTypeMonth
	DateTypeWeekday
	DateTypeDay
)

Variables

View Source
var WeekdayString = []string{"周日", "周一", "周二", "周三", "周四", "周五", "周六"}

Functions

func AddInt added in v1.3.0

func AddInt(s []int, a int) []int

func AddInt64 added in v1.3.0

func AddInt64(s []int64, a int64) []int64

func ConvertBase64ToImage added in v1.2.0

func ConvertBase64ToImage(content string, imagePath, prefixURI string) (string, error)

转换base64为图片链接

func ConvertToLetter added in v1.3.0

func ConvertToLetter(iCol int) string

convert to letter

func DecimalAdd added in v1.6.1

func DecimalAdd(f1, f2 float64) decimal.Decimal

decimal add

func DecimalAddToFloat added in v1.6.1

func DecimalAddToFloat(f1, f2 float64, round int) float64

decimal add to float

func DecimalAddToString added in v1.6.1

func DecimalAddToString(f1, f2 float64, round int) string

decimal add to string

func DecimalDiv added in v1.6.1

func DecimalDiv(f1, f2 float64) decimal.Decimal

decimal div

func DecimalDivToFloat added in v1.6.1

func DecimalDivToFloat(f1, f2 float64, round int) float64

decimal div to float

func DecimalDivToString added in v1.6.1

func DecimalDivToString(f1, f2 float64, round int) string

decimal div to string

func DecimalMul added in v1.6.1

func DecimalMul(f1, f2 float64) decimal.Decimal

decimal mul

func DecimalMulToFloat added in v1.6.1

func DecimalMulToFloat(f1, f2 float64, round int) float64

decimal mul to float

func DecimalMulToString added in v1.6.1

func DecimalMulToString(f1, f2 float64, round int) string

decimal mul to string

func DecimalSub added in v1.6.1

func DecimalSub(f1, f2 float64) decimal.Decimal

decimal sub

func DecimalSubToFloat added in v1.6.1

func DecimalSubToFloat(f1, f2 float64, round int) float64

decimal sub to float

func DecimalSubToString added in v1.6.1

func DecimalSubToString(f1, f2 float64, round int) string

decimal sub to string

func DelFile

func DelFile(files []os.FileInfo, count int, fileDir string)

如果文件达到最上限,按时间删除

func EncryptPhone added in v1.6.1

func EncryptPhone(phone string) string

func Exec

func Exec(bin string, args ...string) (string, error)

func ExecWithTimeout

func ExecWithTimeout(bin string, timeout time.Duration, args ...string) (string, error)

func FileGetContent

func FileGetContent(file string) (string, error)

get string from file

func FileMTime

func FileMTime(file string) (int64, error)

get file modified time

func FilePutContent

func FilePutContent(file string, content string) (int, error)

put string to file

func FileSize

func FileSize(file string) (int64, error)

get file size

func FormatPhone added in v1.6.1

func FormatPhone(mobile string) string

func FormatPhoneNumber added in v1.6.1

func FormatPhoneNumber(phone string) string

U+202A: LEFT-TO-RIGHT EMBEDDING (LRE) U+202B: RIGHT-TO-LEFT EMBEDDING (RLE) U+202D: LEFT-TO-RIGHT OVERRIDE (LRO) U+202E: RIGHT-TO-LEFT OVERRIDE (RLO) U+202C: POP DIRECTIONAL FORMATTING (PDF) U+202C: POP DIRECTIONAL FORMATTING (PDF)

func GeoPositionToDistance added in v1.3.0

func GeoPositionToDistance(from, to GeoPosition) int

单位:米

func GetBoolStr added in v1.6.1

func GetBoolStr(b bool) string

func GetDateBetweenByDateTypeAndDateTime added in v1.6.1

func GetDateBetweenByDateTypeAndDateTime(dateType int, dateTime string, timeFormatParams ...string) (startTimeStr, endTimeStr string)

GetDateBetweenByDateTypeAndDateTime

func GetDateBetweenByDateTypeAndDateTimeAndTimeRange added in v1.6.1

func GetDateBetweenByDateTypeAndDateTimeAndTimeRange(dateType int, dateTime string, timeFormatParams ...string) (string, string, [][]string)

GetDateBetweenByDateTypeAndDateTimeAndTimeRange

func GetFloat32Str added in v1.6.1

func GetFloat32Str(f float32) string

func GetFloat64Str added in v1.4.0

func GetFloat64Str(f float64) string

func GetFloatStr added in v1.4.0

func GetFloatStr(f float64) string

func GetInt16Str added in v1.2.0

func GetInt16Str(d int16) string

func GetInt32Str added in v1.2.0

func GetInt32Str(d int32) string

func GetInt64Str

func GetInt64Str(d int64) string

func GetInt8Str added in v1.2.0

func GetInt8Str(d int8) string

func GetIntStr

func GetIntStr(d int) string

func GetRandomNumber added in v1.3.0

func GetRandomNumber(n int) string

随机码

func GetStrBool

func GetStrBool(strv string, def ...bool) (bool, error)

func GetStrFloat

func GetStrFloat(strv string, def ...float64) (float64, error)

func GetStrFloat32 added in v1.6.1

func GetStrFloat32(strv string, def ...float32) (float32, error)

func GetStrFloat64

func GetStrFloat64(strv string, def ...float64) (float64, error)

func GetStrInt

func GetStrInt(strv string, def ...int) (int, error)

func GetStrInt16

func GetStrInt16(strv string, def ...int16) (int16, error)

func GetStrInt32

func GetStrInt32(strv string, def ...int32) (int32, error)

func GetStrInt64

func GetStrInt64(strv string, def ...int64) (int64, error)

func GetStrInt8

func GetStrInt8(strv string, def ...int8) (int8, error)

func GetStrUint

func GetStrUint(strv string, def ...uint) (uint, error)

func GetStrUint16

func GetStrUint16(strv string, def ...uint16) (uint16, error)

func GetStrUint32

func GetStrUint32(strv string, def ...uint32) (uint32, error)

func GetStrUint64

func GetStrUint64(strv string, def ...uint64) (uint64, error)

func GetStrUint8

func GetStrUint8(strv string, def ...uint8) (uint8, error)

func GetTimeAgo

func GetTimeAgo(t int64) (s string)

GetTimeAgo

func GetUint16Str added in v1.2.0

func GetUint16Str(d uint16) string

func GetUint32Str added in v1.2.0

func GetUint32Str(d uint32) string

func GetUint64Str

func GetUint64Str(d uint64) string

func GetUint8Str added in v1.2.0

func GetUint8Str(d uint8) string

func GetUintStr

func GetUintStr(d uint) string

func GetWeekdayCnName added in v1.4.1

func GetWeekdayCnName(value string) (string, error)

GetWeekdayCnName 获取周一到周日

func InSlice added in v1.3.0

func InSlice(s []string, a string) bool

func IsExist

func IsExist(path string) bool

IsExist returns whether a file or directory exists.

func IsFile

func IsFile(file string) bool

it returns false when it's a directory or does not exist.

func IsImage added in v1.2.0

func IsImage(extName string) bool

检查文件扩展名是否是图片

func Mkdir

func Mkdir(src string) error

create dir

func RandomCreateBytes added in v1.2.0

func RandomCreateBytes(n int, alphabets ...byte) []byte

https://github.com/beego/beego/blob/develop/core/utils/rand.go RandomCreateBytes generate random []byte by specify chars.

func Remove

func Remove(file string) error

delete file

func RemoveAll

func RemoveAll(path string) error

RemoveAll删除path指定的文件,或目录及它包含的任何下级对象。它会尝试删除所有东西,除非遇到错误并返回。 如果path指定的对象不存在,RemoveAll会返回nil而不返回错误。

func Rename

func Rename(file string, to string) error

rename file name

func Repeat added in v1.3.0

func Repeat(s string, count int, sep ...string) string

repeat

func Substr

func Substr(s string, start, length int) string

substr

func Union added in v1.3.0

func Union(s []string, a []string) []string

func Uniq added in v1.3.0

func Uniq(s []string) (r []string)

func WebTime added in v1.2.0

func WebTime(t time.Time) string

WebTime

Types

type FileRepos

type FileRepos []Repository

func (FileRepos) Len

func (r FileRepos) Len() int

func (FileRepos) Less

func (r FileRepos) Less(i, j int) bool

func (FileRepos) Swap

func (r FileRepos) Swap(i, j int)

type GeoPosition added in v1.3.0

type GeoPosition struct {
	Longitude float64 //经度
	Latitude  float64 //纬度
}

type Mail added in v1.2.0

type Mail struct {
	// contains filtered or unexported fields
}

func NewMail added in v1.2.0

func NewMail(host string, port int, username, password string, num ...int64) *Mail

func (*Mail) SendEmailDaemon added in v1.2.0

func (m *Mail) SendEmailDaemon()

func (*Mail) SendEmailOnce added in v1.2.0

func (m *Mail) SendEmailOnce() error

func (*Mail) SetMessage added in v1.2.0

func (m *Mail) SetMessage(params map[string]interface{})

type Repository

type Repository struct {
	Name     string
	FileTime int64
}

Directories

Path Synopsis
aes.go des.go padding.go rsa.go
aes.go des.go padding.go rsa.go

Jump to

Keyboard shortcuts

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