config

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntervalSecond = "SECOND"
	IntervalMinute = "MINUTE"
	IntervalHour   = "HOUR"
	IntervalDay    = "DAY"
	IntervalWeek   = "WEEK"
	IntervalMonth  = "MONTH"
	IntervalYear   = "YEAR"

	IntervalSecondLabel = "秒"
	IntervalMinuteLabel = "分"
	IntervalHourLabel   = "时"
	IntervalDayLabel    = "天"
	IntervalWeekLabel   = "周"
	IntervalMonthLabel  = "月"
	IntervalYearLabel   = "年"
)

interval 定义

View Source
const (
	DbClientGorm = "gorm"
	DbClientEs   = "elastic"
)
View Source
const (
	DbTypeMysql      = "mysql"
	DbTypePostgres   = "postgres"
	DbTypePostgresql = "postgresql"
	DbTypePg         = "pg"
	DbTypeSqlite     = "sqlite"
	DbTypeMssql      = "mssql"
	DbTypeOracle     = "oracle"
	DbTypeSqlserver  = "sqlserver"
	DbTypeTiDB       = "tidb"
)

关系数据库

View Source
const (
	DbTypeMongo = "mongo"
	DbTypeRedis = "redis"
)

kv数据库

View Source
const (
	QueueTypeName     = "消息队列"
	QueueTypeKafka    = "kafka" // kafka消息队列
	QueueTypeRabbit   = "rabbit"
	QueueTypeRocketmq = "rocketmq"
	QueueTypeRabbitmq = "rabbitmq"
)

消息队列

View Source
const (
	QueueKafkaProducer = "kafka_producer" // kafka生产者
	QueueKafkaConsumer = "kafka_consumer" // kafka消费者
)
View Source
const (
	QueueRoleAsync = "async" // 异步
	QueueRoleSync  = "sync"  // 同步
)
View Source
const (
	FileTypeName  = "文件"
	FileTypeFtp   = "ftp"
	FileTypeSftp  = "sftp"
	FileTypeLocal = "local"
	FileTypeOss   = "oss"
	FileTypeMinio = "minio"
	FileTypeHdfs  = "hdfs"
)

文件存储

View Source
const (
	ClusterEtcd      = "etcd"
	ClusterNacos     = "nacos"
	ClusterZookeeper = "zookeeper"
)

集群类型

View Source
const (
	ClientInfoHost   = "host"
	ClientInfoUser   = "user"
	ClientInfoPasswd = "passwd"
)
View Source
const (
	ExportFileTypeExcel = "excel"
	ExportFileTypeCsv   = "csv"
)
View Source
const (
	ProgramLangJAVA   = "java"
	ProgramLangPHP    = "php"
	ProgramLangPYTHON = "python"
	ProgramLangGOLANG = "golang"
	ProgramLangLUA    = "lua"
)
View Source
const (
	ProtocolTCP = "tcp"
	ProtocolUDP = "udp"
)

Variables

View Source
var (
	ErrProtocolInvalid = errors.New("协议无效")
	ErrInvalidParam    = errors.New("无效的参数")
)
View Source
var (
	Help   bool   // 打印显示帮助信息
	Cpath  string // 配置文件路径
	Appath string // 当前路径 // @suppress SpellCheckingInspection
	Dbg    bool   // Debug 模式

	CstSh = time.FixedZone("CST", 8*3600) // 东八区

	PublicKeyByt         []byte // 公钥
	PrivateKeyByt        []byte // 私钥
	EnableParseParamsLog = true
)

noinspection SpellCheckingInspection

View Source
var (
	NumberRegexp = regexp.MustCompile(`^[0-9]+$`)

	SpecialChartPreg = regexp.MustCompile(`[\s;!@#$%^&*()\[\]\:\"\']`)
	WrapSplit        = regexp.MustCompile("\r?\n")
	PhoneRegex       = regexp.MustCompile(`^1(3|4|5|6|7|8|9)\d{9}`)                       // 手机号验证正则
	EmailRegex       = regexp.MustCompile(`(?i)^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$`) // 邮箱验证正则

	PageCharacterSetPreg = regexp.MustCompile(`(?i)<meta[\s\S]+?charset=['"]?([\w-]+)['"][\s\S]*?>`)              // 匹配页面 字符集
	ALinkRegex           = regexp.MustCompile(`(?i)\<(?:a|mip\-link)\s[\s\S]*?href=['"]([\s\S]*?)['"][\s\S]*?\>`) // 匹配页面 所有a标签的正则表达式
	Nofollow             = regexp.MustCompile(`(?i)rel=['"]nofollow['"]`)                                         // 匹配 rel=nofollow
	TitleRegex           = regexp.MustCompile(`(?i)\<title[\s\S]*?\>([\s\S]*?)\<\/title\>`)                       // 匹配页面 title的正则表达式
)
View Source
var IntervalKeyLabelMap = make(map[string]Interval)
View Source
var IntervalKeyMap = make(map[int]Interval)
View Source
var IntervalKeyValMap = make(map[string]Interval)
View Source
var IntervalLists = []Interval{
	{
		Key:   1,
		Val:   IntervalSecond,
		Label: IntervalSecondLabel,
	},
	{
		Key:   60,
		Val:   IntervalMinute,
		Label: IntervalMinuteLabel,
	},
	{
		Key:   3600,
		Val:   IntervalHour,
		Label: IntervalHourLabel,
	},
	{
		Key:   86400,
		Val:   IntervalDay,
		Label: IntervalDayLabel,
	},
	{
		Key:   604800,
		Val:   IntervalWeek,
		Label: IntervalWeekLabel,
	},
	{
		Key:   2592000,
		Val:   IntervalMonth,
		Label: IntervalMonthLabel,
	},
	{
		Key:   31536000,
		Val:   IntervalYear,
		Label: IntervalYearLabel,
	},
}
View Source
var RandPool = sync.Pool{
	New: func() interface{} {
		return rand.New(rand.NewPCG(uint64(time.Now().UnixNano()), uint64(time.Now().UnixNano())))
	},
}

Functions

This section is empty.

Types

type Interval

type Interval struct {
	Key   int    `json:"key" yaml:"key"`     // key
	Val   string `json:"val" yaml:"val"`     // val
	Label string `json:"Label" yaml:"Label"` //单位
}

type SortType

type SortType int
const (
	SortAsc  SortType = iota // 升序
	SortDesc                 // 降序
)

func (SortType) String

func (s SortType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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