common

package
v1.3.1-beta Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnglishOrNumber_ 英文开头,数字字母下划线组合
	EnglishOrNumber_ RegexpPattern = `^[a-zA-Z][a-zA-Z0-9_]*$`
	// AnyEnglishOrNumber_ 数字字母下划线任意组合
	AnyEnglishOrNumber_ = `^[a-zA-Z0-9_]+$`
	// UUIDExp UUID正则 数字字母横杠下划线任意组合
	UUIDExp = `^[a-zA-Z0-9-_]+$`
	// DomainPortExp 域名或者域名:端口
	DomainPortExp = `^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.?[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?(:[0-9]+)?$`
	// IPPortExp IP:PORT
	IPPortExp = `^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}:[0-9]+$`
	// SchemeIPPortExp scheme://IP:PORT
	SchemeIPPortExp = `^[a-zA-z]+://((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}:[0-9]+$`
	// CIDRIpv4Exp IPV4或者IPV4的CIDR
	CIDRIpv4Exp = `` /* 138-byte string literal not displayed */
	// CheckPathIPPortExp (scheme://)?ip:port
	CheckPathIPPortExp = `([a-zA-z]+://)?((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}:[0-9]+`
)

Variables

This section is empty.

Functions

func CheckPathContainsIPPort

func CheckPathContainsIPPort(path string) bool

CheckPathContainsIPPort 检查路径中是否包含xxx://ip:port

func FloatToString

func FloatToString(val float64) string

func FmtFloatFromInterface

func FmtFloatFromInterface(val interface{}) float64

func FmtIntFromInterface

func FmtIntFromInterface(val interface{}) int64

func FmtStringFromInterface

func FmtStringFromInterface(val interface{}) string

func GetFilterAppKey

func GetFilterAppKey(s string) string

GetFilterAppKey 从标准格式appkey{abc}中取得key abc

func GetVariableKey

func GetVariableKey(s string) string

GetVariableKey 从环境变量标准格式${abc}中取得key abc

func IsMatchCIDRIpv4

func IsMatchCIDRIpv4(s string) bool

IsMatchCIDRIpv4 判断字符串是否符合ipv4或者ipv4的cidr

func IsMatchDomainPort

func IsMatchDomainPort(s string) bool

IsMatchDomainPort 判断字符串是否符合域名或者域名:port

func IsMatchFilterAppKey

func IsMatchFilterAppKey(s string) bool

IsMatchFilterAppKey 判断字符串是否匹配策略筛选条件key(应用)标准格式appkey{abc}

func IsMatchIpPort

func IsMatchIpPort(s string) bool

IsMatchIpPort 判断字符串是否符合ip:port

func IsMatchSchemeIpPort

func IsMatchSchemeIpPort(s string) bool

IsMatchSchemeIpPort 判断字符串是否符合scheme://ip:port

func IsMatchString

func IsMatchString(regexpPattern RegexpPattern, s string) error

func IsMatchVariable

func IsMatchVariable(s string) bool

IsMatchVariable 判断字符串是否匹配环境变量标准格式${abc}

func IsRestfulParam

func IsRestfulParam(param string) bool

IsRestfulParam 检查是否为restful参数

func IsRestfulPath

func IsRestfulPath(path string) bool

IsRestfulPath 检查路径是否有restful参数

func ReplaceRestfulPath

func ReplaceRestfulPath(path, replaceStr string) string

ReplaceRestfulPath 将restful路径转换成apinto的正则匹配路径

func SetFilterAppKey

func SetFilterAppKey(key string) string

Types

type RegexpPattern

type RegexpPattern string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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