utils

package
v0.0.0-...-31439ab Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DePwdCode

func DePwdCode(pwd string, ts int64) (string, error)

func Delete

func Delete[T comparable](org, del []T) []T

func DigitRandomConfig

func DigitRandomConfig() *base64Captcha.DriverDigit

func EnPwdCode

func EnPwdCode(pwdStr string, ts int64) (string, error)

func GenerateRandomKey

func GenerateRandomKey(timestamp int64) []byte

func GetIDButNotNumber

func GetIDButNotNumber(baseName string, y int) string

GetIDButNotNumber 生成Cube ID前缀, 2024JIAY 需要自行补充数字

func GetNum

func GetNum(in string) float64

func GetNumbers

func GetNumbers(in string) []float64

func HTTPRequest

func HTTPRequest(method, url string, params, headers map[string]interface{}, data interface{}) ([]byte, error)

HTTPRequest is used to send HTTP request

func Has

func Has[T comparable](org, s []T) []T

func HideEmail

func HideEmail(email string) string

func IsEmailValid

func IsEmailValid(email string) bool

func IsPhoneNumberValid

func IsPhoneNumberValid(phoneNumber string) bool

func MathRandomConfig

func MathRandomConfig() *base64Captcha.DriverMath

MathRandomConfig 生成图形化算术验证码配置

func Merge

func Merge[T comparable](list1, list2 []T) []T

func Page

func Page[T any](src []T, page, size int) (out []T, total int)

func Ptr

func Ptr[T any](t T) *T

func PtrNow

func PtrNow() *time.Time

func PtrTime

func PtrTime(t time.Time) *time.Time

func RandomString

func RandomString(length int) string

func RemoveRepeatedElement

func RemoveRepeatedElement[S ~[]E, E comparable](s S) S

func RemoveSpacesAndTranslate

func RemoveSpacesAndTranslate(input string) string

RemoveSpacesAndTranslate 将输入字符串中的空格移除,并将中文字符翻译成拼音后截取前四位英文

func ReplaceAll

func ReplaceAll(s, new string, old ...string) string

func TIF

func TIF[T any](t bool, a1 T, a2 T) T

func ToJSON

func ToJSON(in interface{}) string

func TranslateEn

func TranslateEn(input string) string

Types

type HTTPTransporter

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

HTTPTransporter define

func NewHTTPTransporter

func NewHTTPTransporter(callTimeout int) *HTTPTransporter

NewHTTPTransporter is used to create HTTP transporter

func (HTTPTransporter) Request

func (s HTTPTransporter) Request(method, url string, params, headers map[string]interface{}, data interface{}) ([]byte, error)

Request is used to send HTTP request

Jump to

Keyboard shortcuts

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