This commit is contained in:
zhaoxiaorong
2025-02-07 13:01:38 +08:00
parent ebcdfe1ee8
commit 57a0d8ae81
52 changed files with 3313 additions and 0 deletions

10
vars/build.go Normal file
View File

@@ -0,0 +1,10 @@
package vars
// build ldflags -x
var (
VERSION string = "0.0"
BUILD_TIME string = "2006-01-02 15:04:05" //time.Now().Format("2006-01-02 15:04:05")
GO_VERSION string = "unset" // runtime.GOOS + "/" + runtime.GOARCH + " " + runtime.Version()
ServiceKey string = "unset"
HostName string = "unset"
)

11
vars/cache.go Normal file
View File

@@ -0,0 +1,11 @@
package vars
import "time"
var (
// cache def value
MemGcDuration time.Duration = 10 * time.Minute
MemLRUMaxNumber int = 1024
MemShardings int = 64
RedisShardings int = 256
)

12
vars/content.go Normal file
View File

@@ -0,0 +1,12 @@
package vars
type ContentType int32
const (
CONTENT_TYPE_TEXT ContentType = iota + 1 // 1.文本
CONTENT_TYPE_IMAGE // 2.图片
CONTENT_TYPE_VIDEO // 3.视频
CONTENT_TYPE_AUDIO // 4.音频
CONTENT_TYPE_LINK // 5.连接
CONTENT_TYPE_LOCATION // 6.定位
)

8
vars/elastic.go Normal file
View File

@@ -0,0 +1,8 @@
package vars
import "runtime"
var (
ESNumWorkers int = runtime.NumCPU()
ESFlushBytes int = 5e+6
)

8
vars/jwt.go Normal file
View File

@@ -0,0 +1,8 @@
package vars
import "time"
var (
// cache def value
JwtExpireDay time.Duration = 1 * 24 * time.Hour
)

9
vars/queue.go Normal file
View File

@@ -0,0 +1,9 @@
package vars
import "time"
var (
MQSpaceName = "Traingo"
OperationTimeout time.Duration = 30 * time.Second
ConnectionTimeout time.Duration = 30 * time.Second
)

7
vars/service.go Normal file
View File

@@ -0,0 +1,7 @@
package vars
var (
RUN_MODE_DEV = "dev"
RUN_MODE_TEST = "test"
RUN_MODE_PROD = "prod"
)

17
vars/sql.go Normal file
View File

@@ -0,0 +1,17 @@
package vars
import "time"
var (
// sql options def val
SqlOptionMaxIdleConns int = 64
SqlOptionMaxOpenConns int = 64
SqlOptionConnMaxLifetime time.Duration = 60 * time.Second
SqlOptionLogStdout bool = true
SqlOptionDebug bool = true
// sql log def val
SqlLogStdout bool = true
SqlLogDir = "logs"
SqlLogFileExt = "log"
)

8
vars/status.go Normal file
View File

@@ -0,0 +1,8 @@
package vars
const (
// NormalStatus .
NormalStatus = 1
// DisabledStatus .
DisabledStatus = -1
)

7
vars/ticker.go Normal file
View File

@@ -0,0 +1,7 @@
package vars
import "time"
var (
ServiceRuntimeDuration time.Duration = 1 * time.Minute
)

7
vars/time.go Normal file
View File

@@ -0,0 +1,7 @@
package vars
var (
YYYYMMDD string = "20060102"
YYYY_MM_DD string = "2006-01-02"
YYYY_MM_DD_HH_MM_SS string = "2006-01-02 15:04:05"
)